Example #1
0
							<?php 
        }
        ?>
						
							</ol>
							 <?php 
        wp_reset_query();
        ?>
						</div>
						<div class="col-sm-12 hilite clearfix">
							<p class="meta" style="text-align:center; padding:1em;">
							<?php 
        // display creative commons?
        if ($my_cc_mode != 'none') {
            // get the license code, either define for site or post meta for user assigned
            $cc_code = $my_cc_mode == 'site' ? ds106bank_option('cc_site') : get_post_meta($post->ID, 'cc', true);
            echo cc_license_html($cc_code, $assignmentAuthor, get_the_time("Y", $my_id));
        }
        ?>
						
						
							</p>
						</div>
					
					</div>
					
					<div id="content" class="row">
						<div class="col-sm-8 ">
					<!-- comments -->	
						<?php 
        comments_template('', true);
<?php

global $wp_query;
// give us query
$term = $wp_query->queried_object;
// the term we need for this taxonomy
// kind of sort passed by paramaters
$sortedby = isset($wp_query->query_vars['srt']) ? $wp_query->query_vars['srt'] : 'newest';
// label for the tutorials, now customizable as theme option
$help_thing_name = lcfirst(ds106bank_option('helpthingname'));
$use_public_ratings = function_exists('the_ratings');
$use_difficulty = ds106bank_option('difficulty_rating');
// we are looking for a random assignment?
if ($sortedby == 'random') {
    // set arguments for WP_Query() using taxonomy
    $args = array('post_type' => 'assignments', 'tax_query' => array(array('taxonomy' => 'assignmenttypes', 'field' => 'slug', 'terms' => $term->slug)), 'posts_per_page' => 1, 'orderby' => 'rand');
    // get a random post from the database
    $my_random_post = new WP_Query($args);
    // process the database request through WP_Query
    while ($my_random_post->have_posts()) {
        $my_random_post->the_post();
        // redirect the user to the random post
        wp_redirect(get_permalink());
        exit;
    }
}
get_header();
?>
			
			<div id="content" class="clearfix row">
			
Example #3
0
<?php

global $wp_query;
// give us query
// kind of sort passed by paramaters
$sortedby = isset($wp_query->query_vars['srt']) ? $wp_query->query_vars['srt'] : 'newest';
// label for the tutorials, now customizable as theme option
$help_thing_name = lcfirst(ds106bank_option('helpthingname'));
// we are looking for a random assignment?
if ($sortedby == 'random') {
    // set arguments for WP_Query() using taxonomy
    $args = array('post_type' => 'assignments', 'posts_per_page' => 1, 'orderby' => 'rand');
    // get a random post from  database
    $my_random_post = new WP_Query($args);
    // process the database request through WP_Query
    while ($my_random_post->have_posts()) {
        $my_random_post->the_post();
        // redirect the user to the random post
        wp_redirect(get_permalink());
        exit;
    }
}
get_header();
?>
			
			<div id="content" class="clearfix row">
			
				<div id="main" class="col-sm-8 clearfix" role="main">

					<?php 
if (function_exists('the_ratings')) {
Example #4
0
					 var RecaptchaOptions = {
						theme : '<?php 
                echo ds106bank_option("captcha_style");
                ?>
'
					 };
					 </script>
			
					<div class="form-group">
						<label for="recaptcha"><?php 
                _e('Spam protection', 'wpbootstrap');
                ?>
</label>
						<span id="recaptchaHelpBlock" class="help-block">Unfortunately, this test is necessary to keep this site safe from spammers. Please enter the code!</span>
						<?php 
                echo recaptcha_get_html(ds106bank_option('captcha_pub'), $captcha_error);
                ?>
						
					</div>
				<?php 
            }
            ?>

					<!-- gotta nonce -->
					<?php 
            wp_nonce_field('bank106_form_add_example', 'bank106_form_add_example_submitted');
            ?>
					
					<!-- hidden data shhhhhh -->
					<input type="hidden" id="aid" value="<?php 
            echo $aid;
Example #5
0
<?php

$use_twitter_name = ds106bank_option('use_twitter_name');
$sub_type = strtolower(ds106bank_option('helpthingname'));
?>

<h2>Title (Fascinating, eh?)</h2>
<p><em>You had me at title...</em><br />
Hopefully this is obvious, but we'd like to encourage you to think about being creative with your choice of title for your <?php 
echo $sub_type;
?>
. It will be what catches someone's eye who might be looking at a long list of <?php 
echo $sub_type;
?>
s. It should be specific to the <?php 
echo $sub_type;
?>
 you are writing and not just echo the name of the particular <?php 
echo THINGNAME;
?>
 you are responding too.</p>
<p>


<h2>Got The Link?</h2>
<p><em>It's not a thing unless it's got a link!</em><br />
The whole idea here is to link to something you have published elsewhere on the web; maybe on your blog, maybe a social media site, maybe as a document. The link must be something people can see without any special logins (and this excludes Facebook unless you are 10000% sure the link is public to more than your "friends").</p>


<p><img src="<?php 
echo get_stylesheet_directory_uri();
Example #6
0
<?php

// type of help content to fetch (in query string)
$typ = $wp_query->query_vars['typ'];
switch ($typ) {
    case 'thing':
        // it's an assignment/thing
        $help_title = 'How to Submit ' . get_the_article(THINGNAME) . THINGNAME;
        break;
    case 'tut':
        // it's for submitting a tutorial/resource
        $help_title = 'How to Submit ' . get_the_article(ds106bank_option('helpthingname')) . ds106bank_option('helpthingname') . ' for ' . get_the_article(THINGNAME) . THINGNAME;
        break;
    default:
        // default assume it's a response
        $help_title = 'How to Submit a Response to ' . get_the_article(THINGNAME) . THINGNAME;
        $typ = 'response';
}
?>

<?php 
get_header();
?>
			
			<div id="content" class="clearfix row">
			
				<div id="main" class="col-sm-8 clearfix" role="main">

					<?php 
if (have_posts()) {
    while (have_posts()) {
 public function get_settings()
 {
     /* General Settings
     		===========================================*/
     $this->settings['thingname'] = array('title' => __('Name for Things in the Bank'), 'desc' => __('What is the name for the kind of thing banked here? Assignment? Challenge? Task? Must be singular and should not contain numbers (0-9).'), 'std' => 'Assignment', 'type' => 'text', 'section' => 'general');
     $this->settings['new_thing_status'] = array('section' => 'general', 'title' => __('Status For New Things'), 'desc' => __('Set to draft to moderate submissions via web form'), 'type' => 'radio', 'std' => 'publish', 'choices' => array('publish' => 'Publish immediately', 'draft' => 'Set to draft'));
     $this->settings['thing_order'] = array('section' => 'general', 'title' => __('Display Order'), 'desc' => __('On the main index, the order in which ' . lcfirst(THINGNAME) . 's are listed'), 'type' => 'radio', 'std' => 'name', 'choices' => array('name' => 'Title', 'id' => 'Date Created', 'count' => 'Count'));
     $this->settings['thing_orderby'] = array('section' => 'general', 'title' => __('Display Order Sorting'), 'desc' => __('Which to list first?'), 'type' => 'radio', 'std' => 'ASC', 'choices' => array('ASC' => 'Ascending', 'DESC' => 'Descending'));
     $this->settings['exlen'] = array('title' => __('Excerpt Length'), 'desc' => __('Number of words to show for content when displayed on an index or archive page'), 'std' => '55', 'type' => 'text', 'section' => 'general');
     $this->settings['use_twitter_name'] = array('section' => 'general', 'title' => __('Use twitter name on submission forms?'), 'desc' => __('Option to use and/or require a twitter name with submission, if used will be added as a tag to entries'), 'type' => 'radio', 'std' => '0', 'choices' => array('0' => 'No', '1' => 'Yes, but make it optional', '2' => 'Yes, and make it required'));
     $this->settings['hashtag'] = array('title' => __('Twitter Hashtag'), 'desc' => __('Optional to be included on Tweet This buttons (do not include the #!)'), 'std' => '', 'type' => 'text', 'section' => 'general');
     // ------- media- thumbnaiil sizes, default image
     $this->settings['thumbnail_heading'] = array('section' => 'general', 'title' => '', 'desc' => 'Media Settings', 'std' => 'If you change any of the thumbnail settings, you may have to regenerate the image sizes to adjust existing media. We suggest installing the <a href="http://wordpress.org/plugins/regenerate-thumbnails/">Regenerate Thumbnails plugin</a>.', 'type' => 'heading');
     $this->settings['thumb_w'] = array('title' => __('Thumbnail Images Width'), 'desc' => __('Width of thumbnail images (in pixels)'), 'std' => '320', 'type' => 'text', 'section' => 'general');
     $this->settings['thumb_h'] = array('title' => __('Thumbnail Images Height'), 'desc' => __('Height of images in pixels'), 'std' => '240', 'type' => 'text', 'section' => 'general');
     $this->settings['def_thumb'] = array('title' => __('Set default ' . lcfirst(THINGNAME) . ' thumbnail image'), 'desc' => __('This image will be used if none is defined.'), 'std' => 'Default ' . lcfirst(THINGNAME) . ' Thumbnail', 'type' => 'medialoader', 'section' => 'general');
     // ------- creative commons options
     $this->settings['cc_heading'] = array('section' => 'general', 'title' => '', 'desc' => 'Apply Creative Commons to ' . THINGNAME . 's', 'std' => '', 'type' => 'heading');
     $this->settings['use_cc'] = array('section' => 'general', 'title' => __('Usage Mode'), 'desc' => __('How licenses are applied'), 'type' => 'radio', 'std' => 'site', 'choices' => array('none' => 'No Creative Commons', 'site' => 'Apply one license to all ' . lcfirst(THINGNAME) . 's', 'user' => 'Enable users to choose license when submitting  a ' . lcfirst(THINGNAME)));
     $this->settings['cc_site'] = array('section' => 'general', 'title' => __('License for All ' . THINGNAME . 's'), 'desc' => __('Choose a license that will appear sitewide'), 'type' => 'select', 'std' => 'by', 'choices' => array('0' => 'CC0 Public Domain', 'by' => 'CC BY Attribution', 'by-sa' => 'CC Attribution-ShareAlike', 'by-nd' => 'CC BY-ND Attribution-NoDerivs', 'by-nc' => 'CC BY-NC Attribution-NonCommercial', 'by-nc-sa' => 'CC BY-NC-SA	Attribution-NonCommercial-ShareAlike', 'by-nc-nd' => 'CC BY-NC-ND Attribution-NonCommercial-NoDerivs'));
     // ------- rating options
     $this->settings['ratings_heading'] = array('section' => 'general', 'title' => '', 'desc' => THINGNAME . ' Ratings', 'std' => bank106_wp_ratings_installed(), 'type' => 'heading');
     $this->settings['difficulty_rating'] = array('section' => 'general', 'title' => __('Allow Author Difficulty Rating'), 'desc' => __('When a new ' . lcfirst(THINGNAME) . ' is created, author assigns a 1-5 difficulty rating shown on the entry'), 'type' => 'checkbox', 'std' => 0);
     // ------- example setup options
     $this->settings['examples_heading'] = array('section' => 'general', 'title' => '', 'desc' => 'Settings for ' . THINGNAME . ' Examples', 'std' => '', 'type' => 'heading');
     $this->settings['example_via_form'] = array('section' => 'general', 'title' => __('Submit examples directly'), 'desc' => __('Allow visitors to submit examples via web form'), 'type' => 'checkbox', 'std' => 1);
     $this->settings['link_examples'] = array('section' => 'general', 'title' => __('Link to Form Submitted Examples'), 'desc' => __('Link to examples external or show as entry (for longer type responses)'), 'type' => 'radio', 'std' => '0', 'choices' => array('1' => 'No, links go to example URL', '0' => 'Yes, links go to entry on the bank site'));
     // Build array to hold options for select, an array of published pages on the site
     $page_options = array('--' => 'Select Page');
     // walk pages
     $all_pages = get_pages();
     foreach ($all_pages as $item) {
         $page_options[$item->post_name] = $item->post_title;
     }
     $this->settings['example_form_page'] = array('section' => 'general', 'title' => __('Page for Adding Examples/Tutorials'), 'desc' => __('Existing page for form to add new examples; one using <strong>Submit Example/Tutorial Form</strong> as template'), 'type' => 'select', 'std' => '--', 'choices' => $page_options);
     $this->settings['new_example_status'] = array('section' => 'general', 'title' => __('Status For New Examples'), 'desc' => __('How new examples added are processed when submitted via a form'), 'type' => 'radio', 'std' => 'draft', 'choices' => array('publish' => 'Publish immediately', 'draft' => 'Set to draft'));
     $this->settings['helpthingname'] = array('title' => __('Name for Support Things'), 'desc' => __('What is the name for the kind of support offerings for each Thing? e.g. Tutorial? Resource? Link? This must be singular, and first letter should be capitalized.'), 'std' => 'Tutorial', 'type' => 'text', 'section' => 'general');
     // ------- syndication options
     $this->settings['syndication_heading'] = array('section' => 'general', 'title' => '', 'desc' => 'Syndication for Examples', 'std' => 'Choose how/if to use Feed WordPress to aggregate examples from either an internal aggregator on this site or from an external source.', 'type' => 'heading');
     $this->settings['use_fwp'] = array('section' => 'general', 'title' => __('Feed Wordpress Mode'), 'desc' => bank106_fwp_installed() . __('See documentation tab for more information on these options.'), 'type' => 'radio', 'std' => 'none', 'choices' => array('none' => 'No syndication. Examples are added only via web form (if enabled above) or only via WordPress Admin.', 'internal' => 'Use a local install of Feed Wordpress to aggregate examples to this site.', 'external' => 'Syndicate from an external site that is already aggregating participant content.'));
     // settings only if external syndication mode
     $this->settings['extra_tag'] = array('title' => __('Required Tag'), 'desc' => __('Only used for external syndication option. Tag for examples to be externally syndicated. This will be displayed on each assignment and will also define the feed that needs to be added to local install of Feed WordPress.'), 'std' => 'bank106', 'type' => 'text', 'section' => 'general');
     $this->settings['syndication_site_name'] = array('title' => __('External Syndication Site '), 'desc' => __('Only used for external syndication option.'), 'std' => 'Groovy Syndication Site Name', 'type' => 'text', 'section' => 'general');
     $this->settings['syndication_site_url'] = array('title' => __('External Syndication Site URL'), 'desc' => __('Only used for external syndication option.'), 'std' => 'http://', 'type' => 'text', 'section' => 'general');
     // ------- captcha options
     $this->settings['captcha_heading'] = array('section' => 'general', 'title' => '', 'desc' => 'Captcha Settings', 'std' => 'To reduce spamm activate a captcha for submission forms', 'type' => 'heading');
     $this->settings['use_captcha'] = array('section' => 'general', 'title' => __('Use reCaptcha'), 'desc' => __('Activate a google captcha for all submission forms; <a href="https://www.google.com/recaptcha/admin/create" target="_blank">get your access keys</a>'), 'type' => 'checkbox', 'std' => 0);
     $this->settings['captcha_style'] = array('section' => 'general', 'title' => __('Captcha Style'), 'desc' => __('Visual style for captchas, see <a href="https://developers.google.com/recaptcha/docs/customization?csw=1" target="_blank">examples of styles</a>.'), 'type' => 'select', 'std' => 'red', 'choices' => array('red' => 'Red', 'white' => 'White', 'blackglass' => 'Black', 'clean' => 'Clean'));
     $this->settings['captcha_pub'] = array('title' => __('reCaptcha Public Key'), 'desc' => __(''), 'std' => '', 'type' => 'text', 'section' => 'general');
     $this->settings['captcha_pri'] = array('title' => __('reCaptcha Private Key'), 'desc' => __(''), 'std' => '', 'type' => 'text', 'section' => 'general');
     /* Types of Things Settings
     		===========================================*/
     // lets get all the existing assignment types
     $assigntypes = get_assignment_types(ds106bank_option('thing_order'), ds106bank_option('thing_orderby'));
     $i = 0;
     foreach ($assigntypes as $atype) {
         $i++;
         $setting_name = 'thing_type_' . $atype->term_id;
         // ------- settings for each type of thing: name, delete option, description, thumbnail
         $this->settings["{$setting_name}"] = array('title' => __(THINGNAME . ' Type #' . $i), 'desc' => __(''), 'std' => '', 'type' => 'text', 'section' => 'types');
         $this->settings['del_' . $setting_name] = array('section' => 'types', 'title' => __('Delete this type'), 'desc' => __('Be careful, this cannot be undone!'), 'type' => 'checkbox', 'std' => 0);
         $this->settings[$setting_name . '_descrip'] = array('title' => __('Short Description'), 'desc' => __(''), 'std' => '', 'type' => 'textarea', 'section' => 'types');
         $this->settings[$setting_name . '_thumb'] = array('title' => __(ucfirst($atype->name) . ' Thumbnail'), 'desc' => __('<hr /><p>&nbsp;</p>'), 'std' => 'http://placehold.it/' . THUMBW . 'x' . THUMBH, 'type' => 'medialoader', 'section' => 'types');
     }
     // ------- field so users can add new types of things
     $this->settings['new_type_heading'] = array('section' => 'types', 'title' => '', 'desc' => 'Create New ' . THINGNAME . ' Types', 'std' => 'Description and thumbnails can be added after saving changes. If the type already exists, a repeated name will be ignored.', 'type' => 'heading');
     $this->settings['new_types'] = array('title' => __('Names for new type(s)'), 'desc' => __('Enter new names, one per line'), 'std' => 'New Type Name', 'type' => 'textarea', 'section' => 'types');
     /* Reset
     		===========================================*/
     $this->settings['reset_theme'] = array('section' => 'reset', 'title' => __('Reset Options'), 'type' => 'checkbox', 'std' => 0, 'class' => 'warning', 'desc' => __('Check this box and click "Save Changes" below to reset assignment bank options to their defaults.'));
 }
Example #8
0
 						
 						
							<article role="article" class="thing-archive">
								<!--  thing name header -->
								<header>							
									<h3 class="h2"><?php 
        echo $type_url_str . $atype->name;
        ?>
</a></h3>
								</header> 
								<!-- end thing header -->

								<!-- thing icon -->		
								<div class="thing-icon">
								<?php 
        echo $type_url_str . '<img src="' . ds106bank_option('thing_type_' . $atype->term_id . '_thumb') . '" alt="' . $atype->name . ' assignments" /></a>';
        ?>
								</div>
								<!-- end icon -->
					
								<!-- thing content -->
								<section class="post_content">
						
									<p><?php 
        echo $atype->description;
        ?>
</p>
									<p class="more-link"><?php 
        echo $type_url_btn;
        ?>
View <?php 
Example #9
0
<?php

get_header();
?>
			
			<div id="content" class="clearfix row">
			
				<div id="main" class="col-sm-10 clearfix" role="main">
				
					<div class="page-header">
 						<h1 class="archive_title h2">
					    	<span><?php 
_e('All ' . THINGNAME . ' Responses and ' . ds106bank_option('helpthingname') . 's', "wpbootstrap");
?>
 </span>
					    </h1>					</div>

					<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
					

						<?php 
        // is it a response (example) or tutorial?
        $extype = get_examples_type_by_tax($post->ID);
        // get the ID for the assignment this belongs to
        $aid = get_assignment_id_from_terms(get_the_ID());
        // make a link string
        $assignment_str = $aid ? '<a href="' . get_permalink($aid) . '">' . get_the_title($aid) . '</a>' : '';
Example #10
0
<?php

$use_full_editor = ds106bank_option('link_examples');
$use_twitter_name = ds106bank_option('use_twitter_name');
?>

<h2>Title (Fascinating, eh?)</h2>
<p><em>You had me at title...</em><br />
Hopefully this is obvious, but we'd like to encourage you to think about being creative with your choice of title for your response. It will be what catches someone's eye who might be looking at a long list of responses. It should be specific to the response you are writing and not just echo the name of the particular <?php 
echo THINGNAME;
?>
 you are responding too.</p>
<p>

<?php 
if (ds106bank_option('link_examples')) {
    ?>

<h2>Got The Link?</h2>
<p><em>It's not a thing unless it's got a link!</em><br />
The whole idea here is to link to something you have published elsewhere on the web; maybe on your blog, maybe a social media site, maybe as a document. The link must be something people can see without any special logins (and this excludes Facebook unless you are 10000% sure the link is public to more than your "friends").</p>


<p><img src="<?php 
    echo get_stylesheet_directory_uri();
    ?>
/images/add-ex-link1.jpg" alt="" style="border:3px solid #000;" /></p>

<p>Make sure the links works! Click the orange <code>TEST</code> button to see if the link works (it opens in a new browser window).</p>

Example #11
0
<?php

global $wp_query;
// give us query or ....
get_header();
?>
			
			<div id="content" class="clearfix row">
			
				<div id="main" class="col-sm-10 clearfix" role="main">
				
					<div class="page-header">
 						<h1 class="archive_title h2">
 						
					    	<span><?php 
echo THINGNAME . ' Responses and ' . ds106bank_option('helpthingname') . 's ';
// fetch the tag in question
$the_tag = single_term_title('', false);
if ($the_tag[0] == '@') {
    // this is a twitter tag
    echo "Contributed by {$the_tag}";
} else {
    // just a regular tag
    echo 'Tagged "' . $the_tag . '"';
}
?>
							
							</h1>
							<p class="text-center"><strong><?php 
echo $wp_query->found_posts;
?>
Example #12
0
function bank106_twitter_credit_link($post_id, $prefix = '', $suffix = '', $path = 'tag')
{
    // if a given item has a twitter credit, return an HTML credit link string
    // path = 'tag' for challenges, and  'exampletags' for examples
    // look for a tweeter
    $tweeter = get_post_meta($post_id, 'submitter_twitter', true);
    if (ds106bank_option('use_twitter_name') and $tweeter) {
        // we will try if we are even requiring twitter names and if one exixts
        return $prefix . '<a href="' . site_url() . '/' . $path . '/' . $tweeter . '">' . $tweeter . '</a>' . $suffix;
    } else {
        // otherwise, send nothing
        return '';
    }
}