本文整理汇总了PHP中qa_self_html函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_self_html函数的具体用法?PHP qa_self_html怎么用?PHP qa_self_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_self_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: head_script
function head_script()
{
qa_html_theme_base::head_script();
if (qa_opt('voting_on_cs') && isset($this->content['q_view'])) {
$this->output("\n<script type='text/javascript'>\n\tfunction ajaxCommentVote(elem, oldvote)\n\t{\n\t\tvar ens=elem.getAttribute('name').split('_');\n\t\tvar postid=ens[1];\n\t\tvar vote=parseInt(ens[2]);\n\t\tvar anchor=ens[3];\n\t\tvar which=parseInt(ens[4]);\n\n\t\tvar dataString = 'ajax_comment_vote_id='+postid+'&ajax_comment_vote='+vote; \n\n\t\tjQuery.ajax({ \n\t\t type: 'POST', \n\t\t url: '" . qa_self_html() . "', \n\t\t data: dataString, \n\t\t dataType: 'json', \n\t\t success: function(json) {\n\t\t\t\tif (json.status=='1') {\n\t\t\t\t\tswitch(vote) {\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\tvar up = 0;\n\t\t\t\t\t\t\tvar up_type = '-selected';\n\t\t\t\t\t\t\tvar down_type = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase -1:\n\t\t\t\t\t\t\tvar down = 0;\n\t\t\t\t\t\t\tvar up_type = false;\n\t\t\t\t\t\t\tvar down_type = '-selected';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\tvar up = 1;\n\t\t\t\t\t\t\tvar down = -1;\n\t\t\t\t\t\t\tvar up_type = '';\n\t\t\t\t\t\t\tvar down_type = '';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}" . (!qa_opt('voting_down_cs') ? "\n\t\t\t\t\t\n\t\t\t\t\tdown_type = false;\n" : "") . "\n\t\t\t\t\telem.parentNode.innerHTML = (up_type!==false?'<div class=\"comment-vote-item'+up_type+'\" name=\"vote_'+ens[1]+'_'+up+'_c'+ens[1]+'_1\" onclick=\"ajaxCommentVote(this);\" title=\"'+json.up+'\">▲</div>':'')+(parseInt(json.data)!=0?'<div id=\"voting_'+ens[1]+'\" title=\"json.up\">'+(json.data!='0'?json.data:'')+'</div>':'')+(down_type!==false?'<div class=\"comment-vote-item'+down_type+'\" name=\"vote_'+ens[1]+'_'+down+'_c'+ens[1]+'_-1\" onclick=\"ajaxCommentVote(this);\" title=\"'+json.down+'\">▼</div>':'');\n\n\t\t\t\t} else if (json.status=='0') {\n\t\t\t\t\tvar mess=document.getElementById('errorbox');\n\t\t\t\t\tif (!mess) {\n\t\t\t\t\t\tvar mess=document.createElement('div');\n\t\t\t\t\t\tmess.id='errorbox';\n\t\t\t\t\t\tmess.className='qa-error';\n\t\t\t\t\t\tmess.innerHTML=json.data;\n\t\t\t\t\t}\n\t\t\t\t\tvar postelem=document.getElementById(anchor);\n\t\t\t\t\tpostelem.parentNode.insertBefore(mess, postelem);\n\t\t\t\t} else {\n\t\t\t\t\talert('Unexpected response from server - please try again.');\n\t\t\t\t}\n\t\t\t} \n\t\t});\n\t\treturn false;\n\t} \t\n</script>");
}
}
示例2: it_q_list_page_content
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
return $qa_content;
}
示例3: head_custom
function head_custom()
{
if ($this->template == 'admin') {
$this->output("\n\t<script>\t\t\t\n\tfunction mergePluginGetPosts() {\n\t\tvar from=jQuery('#merge_from').val();\n\t\tvar to=jQuery('#merge_to').val();\n\n\t\tvar dataString = 'ajax_merge_get_from='+from+'&ajax_merge_get_to='+to; \n\t\tjQuery.ajax({ \n\t\t type: 'POST', \n\t\t url: '" . qa_self_html() . "', \n\t\t data: dataString, \n\t\t dataType: 'json', \n\t\t success: function(json) {\n\t\t\t\tjQuery('#merge_from_out').html('Merging from: <a href=\"'+json.from_url+'\">'+json.from+'</a>');\n\t\t\t\tjQuery('#merge_to_out').html('To: <a href=\"'+json.to_url+'\">'+json.to+'</a>');\n\t\t\t} \n\t\t});\n\t\treturn false;\n\t}\n\t</script>");
}
qa_html_theme_base::head_custom();
}
示例4: process_request
function process_request($request)
{
$userid = qa_get_logged_in_userid();
$categoryoptions = array();
$qa_content = qa_content_prepare();
// check if we have done a post of the page
if (qa_post_text('okthen')) {
// update the current category
$newcategory = qa_post_text('category');
if (isset($newcategory)) {
mp_set_categoryid($newcategory);
// redirect to main page
qa_redirect('');
} else {
$qa_content['error'] = 'You must select a course to continue.';
}
}
// retrieve list of categories user is associated with
// populate category options
$results = mp_get_categories_for_user($userid);
foreach ($results as $row) {
$categoryoptions[$row['categoryid']] = $row['title'];
}
$qa_content['title'] = 'Registered courses';
$qa_content['custom'] = 'The following list displays all courses your account is associated with. Select a course from the list below and click <B>Select</B> to change to the new course<br /><br />';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('courses' => array('type' => 'select-radio', 'label' => 'Courses', 'tags' => 'NAME="category"', 'options' => $categoryoptions, 'value' => mp_get_categoryid(), 'error' => qa_html(@$errors['course']))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'Select', 'value' => '1')));
return $qa_content;
}
示例5: head_script
function head_script()
{
qa_html_theme_base::head_script();
if (qa_opt('ajax_comment_enable') && !$this->qa_state && $this->template == 'question' && $this->can_comment) {
$this->output_raw("\n\t<style>\n\t\t.ajax-comment-hidden {\n\t\t\tdisplay:none;\n\t\t}\n\t\t.ajax-comment-reminder {\n\t\t\tfont-size:10px;\n\t\t\tfont-style:italic;\n\t\t}\n\t\t.ajax-comment-vote-popup {\n\t\t\tposition: absolute; \n\t\t\tbackground-color:yellow; \n\t\t\tpadding:10px;\n\t\t\tborder:1px solid; \n\t\t\tmargin-left:20px; \n\t\t\tmargin-top:45px; \n\t\t\ttext-align:justify; \n\t\t\twidth:250px; \n\t\t\tfont-weight:bold;\n\t\t\tcursor:pointer;\n\t\t\tdisplay:none;\n\t\t}\n\t</style>");
$this->output_raw("\n\t<script>\n\t\n\t\tfunction flashStar(idx) {\n\t\t\n\t\t\tvar star = jQuery('.qa-a-select-button').eq(idx-1);\n\t\t\tstar.attr('class','qa-a-select-hover');\n\t\t\tstar.fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow',function(){\n\t\t\t\tstar.attr('class','qa-a-select-button').fadeIn('slow');\n\t\t\t});\n\t\t}\n\n\t\tfunction voteReminderNotice(elem,idx) {\n\t\t\tflashStar(idx);\n\t\t\tjQuery('<div class=\"ajax-comment-vote-popup\" onclick=\"this.style.display=\\'none\\';\">" . qa_html(qa_opt('ajax_comment_popup_notice_text')) . "</div>').insertAfter(elem.parentNode.parentNode).fadeIn('fast').delay(8000).fadeOut('slow');\n\t\t}\n\t\n\t\tvar ajax_comment_position = 0;\n\t\tvar ajax_comment_id = 0;\n\t\tvar ajax_comment_height = 0;\n\t\tfunction toggleComment(idx,username,flash) {\n\t\t\tjQuery('.ajax-comment').hide('slow');\n\t\t\t\n\t\t\tif(idx === false) {\n\t\t\t\tjQuery('textarea#comment').val('');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar cDiv = jQuery('#ajax-comment-'+idx);\n\t\t\t\n\t\t\tif(cDiv.length) {\n\t\t\t\tif(ajax_comment_position != idx) {\n\t\t\t\t\tcDiv.append(jQuery('#ajax-comment-'+ajax_comment_position).html());\n\t\t\t\t\tjQuery('#ajax-comment-'+ajax_comment_position).html('');\n\t\t\t\t\tajax_comment_position = idx;\n\t\t\t\t}\n\n\t\t\t\tif(!cDiv.is(':visible')) {\n\t\t\t\t\t\n\t\t\t\t\t// flash star\n\t\t\t\t\t\t\n\t\t\t\t\tif(flash && !jQuery('.qa-a-item-selected').length) flashStar(flash);\n\t\t\t\t\t\n\t\t\t\t\t// check if onscreen\n\t\t\t\t\t\n\t\t\t\t\tvar top = (-1)*jQuery('html').offset().top;\n\t\t\t\t\tvar cTop = cDiv.prev().offset().top + cDiv.prev().height();\n\t\t\t\t\tvar bot = top + jQuery(window).height();\n\t\t\t\t\t\n\t\t\t\t\tif (cTop > top && cTop < bot) {\n\t\t\t\t\t\tcDiv.show('slow',function(){\n\t\t\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcDiv.show();\n\t\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').val((username?'@'+username+' ':''));\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(username) {\n\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').val(jQuery('#ajax-comment-'+idx+' textarea#comment').val()+'@'+username+' ');\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfunction ajaxPostComment() {\n\t\t\tvar cText = jQuery('#ajax-comment-'+ajax_comment_position+' textarea#comment');\n\t\t\tvar content = cText.val();\n\t\t\t\n\t\t\tvar notify = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"notify\"]').attr('checked');\n\t\t\tvar email = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"email\"]').val();\n\t\t\tvar editor = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"editor\"]').val();\n\t\t\tvar oldcss = cText.css('background');\n\t\t\tcText.css('background','url(" . QA_HTML_THEME_LAYER_URLTOROOT . "ajax-loader.gif) no-repeat scroll center center silver');\n\t\t\t//cText.val('');\n\t\t\t\n\t\t\tvar dataString = 'ajax_id='+ajax_comment_position+'&ajax_comment_content='+content+(ajax_comment_position!=0?'&ajax_comment_id='+document.getElementById('ajax-comment-'+ajax_comment_position).getAttribute('value'):'')+(notify?'¬ify='+notify:'')+(email?'&email='+email:'')+(editor?'&editor='+editor:''); \n\t\t\tjQuery.ajax({ \n\t\t\t type: 'POST', \n\t\t\t url: '" . qa_self_html() . "', \n\t\t\t data: dataString, \n\t\t\t success: function(data) {\n\t\t\t\tif(/^[\\t\\n ]*###/.exec(data)) {\n\t\t\t\t\tvar error = data.replace(/^[\\t\\n ]*### */,'');\n\t\t\t\t\twindow.alert(error);\n\t\t\t\t\t//cText.val(content);\n\t\t\t\t}\n\t\t\t\telse if(ajax_comment_position == 0) {\n\t\t\t\t\tif(jQuery('.qa-q-view-c-list').length == 0) jQuery('<div class=\"qa-q-view-c-list\">'+data+'</div>').insertBefore('#ajax-comment-'+ajax_comment_position).find('div.qa-c-list-item:last').show('slow',function () {slideToDiv('.qa-q-view-c-list')});\n\t\t\t\t\telse jQuery('.qa-q-view-c-list').append(data).find('div.qa-c-list-item:last').show('slow',function () {slideToDiv('.qa-q-view-c-list')});\n\t\t\t\t\ttoggleComment(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(!document.getElementById('ajax-comment-'+ajax_comment_position).getAttribute('comments')) {\n\t\t\t\t\t\tdocument.getElementById('ajax-comment-'+ajax_comment_position).setAttribute('comments','true');\n\t\t\t\t\t\tjQuery('<div class=\"qa-a-item-c-list\">'+data+'</div>').insertBefore('#ajax-comment-'+ajax_comment_position).find('div.qa-c-list-item:last').show('slow');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tjQuery('.ajax-comment-idx-'+ajax_comment_position).append(data).find('div.qa-c-list-item:last').show('slow');\n\t\t\t\t\t}\n\t\t\t\t\ttoggleComment(false);\n\t\t\t\t}\n\t\t\t\tcText.css('background',oldcss);\n\t\t\t } \n\t\t\t});\n\t\t}\n\t\t\n\t\tfunction slideToDiv(div) {\n\t\t\tvar cDiv = jQuery(div);\n\t\t\tif(cDiv.length) {\n\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t}\t\t\t\n\t\t}\n\t\t\n\t</script>");
}
}
示例6: process_request
function process_request($request)
{
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('example_page/page_title');
$qa_content['error'] = 'An example error';
$qa_content['custom'] = 'Some <B>custom html</B>';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
$qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
return $qa_content;
}
示例7: process_request
function process_request($request)
{
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('example_page/page_title');
$qa_content['error'] = 'An example error';
$qa_content['custom'] = 'Some <b>custom html</b>';
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'name="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'name="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
$qa_content['custom_2'] = '<p><br>More <i>custom html</i></p>';
return $qa_content;
}
示例8: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'app/format.php';
require_once QA_INCLUDE_DIR . 'app/updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$defaults['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
if (!empty($fields['raw']['closedbyid'])) {
$fields['closed'] = array('state' => qa_lang_html('main/closed'));
}
$qa_content['q_list']['qs'][] = $fields;
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($userid) && isset($categoryid)) {
$favoritemap = qa_get_favorite_non_qs_map();
$categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例9: qa_favorite_q_list_view
function qa_favorite_q_list_view($questions, $usershtml)
{
$q_list = array('qs' => array());
if (count($questions) === 0) {
return $q_list;
}
$q_list['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$defaults = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, qa_get_logged_in_userid(), qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
return $q_list;
}
示例10: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
$allowEdit = !qa_user_permit_error('fb_share_permit_edit');
$parts = explode('/', qa_self_html());
if ($allowEdit && $parts[2] == qa_get_logged_in_handle()) {
$appid = qa_opt('fb_app_id');
$secret = qa_opt('fb_app_secret');
$fb = new Facebook\Facebook(['app_id' => $appid, 'app_secret' => $secret, 'default_graph_version' => 'v2.4']);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email', 'publish_actions'];
$callback = 'http://nathorr.com/qeta/fb-share/' . qa_get_logged_in_handle() . '/';
$loginUrl = $helper->getLoginUrl($callback, $permissions);
echo '<a href="' . $loginUrl . '"><img src="http://oi57.tinypic.com/f1xlbt.jpg"></a>';
}
}
示例11: process_request
function process_request($request)
{
// perform userinfuser registration
$ui = new UserInfuser("ezegarra@yahoo.com", "0658a511-d890-4e51-ba9e-126d6c0a12f2");
$ui->update_user(qa_get_logged_in_email(), qa_get_logged_in_userid(), "", "");
$ui->award_points(qa_get_logged_in_email(), 1000);
$pw = $ui->get_widget(qa_get_logged_in_email(), "points", 100, 100);
$lw = $ui->get_widget(qa_get_logged_in_email(), "leaderboard", 600, 300);
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Example plugin page';
$qa_content['error'] = 'An example error';
$qa_content['custom'] = 'Some <B>custom html</B>';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request' . qa_get_logged_in_userid(), 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
$qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
$qa_content['custom_3'] = $pw . $lw;
return $qa_content;
}
示例12: process_request
function process_request($request)
{
$parts = explode('/', $request);
$tag = $parts[1];
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Edit the description for Fture test ' . qa_html($tag);
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => 'Save Description')));
if (qa_clicked('dosave')) {
require_once QA_INCLUDE_DIR . 'qa-util-string.php';
$taglc = qa_strtolower($tag);
qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
qa_redirect('tag/' . $tag);
}
$qa_content['focusid'] = 'tagdesc';
return $qa_content;
}
示例13: process_request
function process_request($request)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
require_once QA_INCLUDE_DIR . 'mp-db-users.php';
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING']));
// create the editor and update its content
qa_get_post_content('editor', 'content', $ineditor, $incontent, $informat, $intext);
$editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$incontent, @$informat, $editorname);
// retrieve variable data
$innotify = qa_post_text('notify') ? true : false;
// handle creation of annoucement
if (qa_post_text('docreate')) {
//retrieve data
$title = qa_post_text('title');
$content = $incontent;
$format = $informat;
// validate data
// handle create work
// actual create process is in file mp-app-posts.php
$postid = qa_post_create('AN', null, $title, $content, $format, mp_get_categoryid(), null, qa_get_logged_in_userid(), $innotify);
// redirect page
qa_redirect('mp-announcements-page');
// our work is done here
}
$qa_content = qa_content_prepare();
// if the user is not logged in, request user to login
if (!qa_get_logged_in_userid()) {
$qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request);
return $qa_content;
}
$qa_content['title'] = 'Create Announcement';
$qa_content['form_newannouncement'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('announcements/a_title_label'), 'tags' => 'NAME="title"', 'value' => qa_html(qa_post_text('title')), 'error' => qa_html(@$errors['title'])), 'content' => array_merge($editor->get_field($qa_content, @$incontent, @$informat, 'content', 12, false), array('label' => qa_lang_html('announcements/a_content_label'), 'error' => qa_html(@$errors['content']))), 'notify' => array('label' => 'Send email notification to all registered students', 'tags' => 'NAME="notify"', 'type' => 'checkbox', 'value' => qa_html($innotify))), 'buttons' => array('ok' => array('tags' => 'NAME="docreate"', 'label' => 'Create Announcement', 'value' => '1')), 'hidden' => array('hiddenfield' => '1', 'editor' => qa_html($editorname)));
// create the sub menu for navigation
$qa_content['navigation']['sub'] = mp_announcements_sub_navigation();
$qa_content['navigation']['sub']['create']['selected'] = true;
return $qa_content;
}
示例14: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
global $qa_login_userid, $qa_cookieid, $qa_request;
// get globals from qa-page.php
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$options = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$options['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例15: newsletterForm
function newsletterForm()
{
$fields = array();
$ok = null;
$tags = null;
$buttons = array();
$userid = qa_get_logged_in_userid();
require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
if (qa_clicked('newsletter_send_save')) {
qa_db_usermeta_set($userid, 'newsletter', (bool) qa_post_text('newsletter_send_me'));
$ok = qa_lang('badges/badge_notified_email_me');
}
$selected = (bool) qa_db_usermeta_get($userid, 'newsletter');
$tags = 'id="badge-form" action="' . qa_self_html() . '#signature_text" method="POST"';
$fields[] = array('type' => 'blank');
$text = str_replace('^email', $this->getEmail($userid), qa_lang('newsletter/newsletter_send_me'));
$text = str_replace('^newsletter', qa_opt('site_url') . qa_opt('news_plugin_request'), $text);
$text = str_replace('^days', qa_opt('news_plugin_send_days'), $text);
$fields[] = array('label' => $text, 'type' => 'checkbox', 'tags' => 'NAME="newsletter_send_me"', 'value' => $selected);
$buttons[] = array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="newsletter_send_save"');
return array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'tags' => $tags, 'title' => qa_lang('newsletter/newsletter'), 'fields' => $fields, 'buttons' => $buttons);
}