示例#1
0
 /**
  * Get the tempcode for the form to add a banner, with the information passed along to it via the parameters already added in.
  *
  * @param  ID_TEXT			The name of the banner
  * @param  URLPATH			The URL to the banner image
  * @param  URLPATH			The URL to the site the banner leads to
  * @param  SHORT_TEXT		The caption of the banner
  * @param  LONG_TEXT			Any notes associated with the banner
  * @param  integer			The banners "importance modulus"
  * @range  1 max
  * @param  ?integer			The number of hits the banner may have (NULL: not applicable for this banner type)
  * @range  0 max
  * @param  SHORT_INTEGER	The type of banner (0=permanent, 1=campaign, 2=default)
  * @set    0 1 2
  * @param  ?TIME				The banner expiry date (NULL: never expires)
  * @param  ?MEMBER			The banners submitter (NULL: current member)
  * @param  BINARY				Whether the banner has been validated
  * @param  ID_TEXT			The banner type (can be anything, where blank means 'normal')
  * @param  SHORT_TEXT		The title text for the banner (only used for text banners, and functions as the 'trigger text' if the banner type is shown inline)
  * @return array				Bits
  */
 function get_form_fields($name = '', $image_url = '', $site_url = '', $caption = '', $notes = '', $importancemodulus = 3, $campaignremaining = 50, $the_type = 1, $expiry_date = NULL, $submitter = NULL, $validated = 1, $b_type = '', $title_text = '')
 {
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'b_type';
     if ($b_type == '') {
         $b_type = get_param('b_type', '');
     }
     $fields = get_banner_form_fields(false, $name, $image_url, $site_url, $caption, $notes, $importancemodulus, $campaignremaining, $the_type, $expiry_date, is_null($submitter) ? NULL : $GLOBALS['FORUM_DRIVER']->get_username($submitter), $validated, $b_type, $title_text);
     // Permissions
     if (get_option('use_banner_permissions') == '1') {
         $fields->attach($this->get_permission_fields($name, NULL, $name == ''));
     }
     $edit_text = $name == '' ? new ocp_tempcode() : do_template('BANNER_PREVIEW', array('PREVIEW' => show_banner($name, $title_text, comcode_to_tempcode($caption, $submitter), $image_url, '', $site_url, $b_type)));
     $hidden = new ocp_tempcode();
     handle_max_file_size($hidden, 'image');
     return array($fields, $hidden, NULL, $edit_text);
 }
示例#2
0
 /**
  * Standard stage of pointstore item purchase.
  *
  * @return tempcode		The UI
  */
 function newbanner()
 {
     if (get_option('is_on_banner_buy') == '0') {
         return new ocp_tempcode();
     }
     $this->handle_has_banner_already();
     //We can purchase a banner...
     $initial_hits = intval(get_option('initial_banner_hits'));
     $banner_price = intval(get_option('banner_setup'));
     $text = paragraph(do_lang_tempcode('BANNERS_DESCRIPTION', integer_format($initial_hits), integer_format($banner_price)));
     $fields = get_banner_form_fields(true);
     $title = get_page_title('ADD_BANNER');
     $post_url = build_url(array('page' => '_SELF', 'type' => '_newbanner', 'id' => 'banners', 'uploading' => 1), '_SELF');
     $javascript = 'standardAlternateFields(\'file\',\'image_url\',\'title_text\',true); if (document.getElementById(\'campaignremaining\')) { var form=document.getElementById(\'campaignremaining\').form; var crf=function() { form.elements[\'campaignremaining\'].disabled=(!form.elements[\'the_type\'][1].checked); }; crf(); form.elements[\'the_type\'][0].onclick=crf; form.elements[\'the_type\'][1].onclick=crf; form.elements[\'the_type\'][2].onclick=crf; }';
     $hidden = new ocp_tempcode();
     handle_max_file_size($hidden, 'image');
     return do_template('FORM_SCREEN', array('_GUID' => '45b8878d92712e07c4eb5497f1a33e33', 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => do_lang_tempcode('ADD_BANNER'), 'JAVASCRIPT' => $javascript));
 }