Created
February 3, 2015 18:54
-
-
Save vimes1984/bd32e8a11f12aaece1d9 to your computer and use it in GitHub Desktop.
Client single after refactoring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<?php $user_ID = get_current_user_id(); ?> | |
<div ng-controller="singletype" ng-cloak> | |
<div class="col-md-8"> | |
<?php | |
if( is_user_logged_in() ) { | |
while ( have_posts() ) : the_post(); | |
//Default values | |
$pluginClass = ClientExchangePlugin::get_instance(); | |
$checkresults = count( $wpdb->get_results( "SELECT ID FROM wp_watchlist WHERE watching = $post->ID AND userID = $user_ID" ) ); | |
$checkresults_deal = count( $wpdb->get_results( "SELECT ID FROM wp_deals WHERE listingID = $post->ID AND Buyer = $user_ID" ) ); | |
$postmeta = get_post_meta( $post->ID); | |
$tojson['listingID'] = $post->ID; | |
$authormeta = get_user_meta($post->post_author); | |
$user_info = get_userdata($post->post_author); | |
$currenusermeta = $current_user->data; | |
$listingauthor = $user_info->data; | |
$user_email = get_the_author_meta('user_firstname'); | |
$avatarurl = @$pluginClass->get_avatar_url($listingauthor->data->ID); | |
$jsonreturn = listing_author_array($postmeta, $listingauthor, $currenusermeta); | |
$set_listing_type = set_listing_type($jsonreturn["wpcf_listing_type"]); | |
$jsonarray = json_encode($jsonreturn); | |
?> | |
<div class="initvalue" ng-init='singlelistarray = <?php echo $jsonarray; ?> ' ></div> | |
<div class="initvalue" ng-init='checkdeal = <?php echo $checkresults_deal; ?> ' ></div> | |
<div class="wrapper_listing" ng-init="checkwatching = <?php echo $checkresults; ?> " > | |
<div class="avada-row"> | |
<div class="col-md-12"> | |
<h2><?php the_title();?></h2> | |
</div> | |
</div> | |
<hr> | |
<div class="avada-row"> | |
<div class="col-md-4"> | |
<?php if( isset($jsonreturn['wpcf_logo']) ){ | |
echo "<img src='".$jsonreturn['wpcf_logo'] ."' /> "; | |
}else{ | |
echo "<img src='$avatarurl' />"; | |
} | |
?> | |
<h2><?php echo $set_listing_type; ?>: <?php echo get_the_author_meta('user_firstname'); ?> <?php echo get_the_author_meta('user_lastname'); ?></h2> | |
</div> | |
</div> | |
<hr> | |
<p>Location: <?php echo $jsonreturn["wpcf_city"]; ?> / <?php echo $jsonreturn["wpcf_state"] ?></p> | |
<p>Asking Price: $<?php echo $jsonreturn['wpcf_asking_price']; ?></p> | |
<p>Mutual Fund Licensed: <?php echo $jsonreturn['wpcf_mutual_fund_licensed']; ?></p> | |
<p>Life Insurance Licensed: <?php echo $jsonreturn['wpcf_life_insurance_licensed']; ?></p> | |
<p>Liscenses and/or other designations: <?php echo $jsonreturn["wpcf_other_license"]; ?></p> | |
<p>Description: <?php echo $jsonreturn["wpcf_buisness_description"]; ?></p> | |
<button ng-show="checkwatching == 0 " ng-click="watchlist(<?php echo $user_ID; ?>, <?php echo $post->ID; ?> )">Add to Watch List</button> | |
<button ng-show="checkwatching == 1 " ng-click="watchlistremove(<?php echo $user_ID; ?>, <?php echo $post->ID; ?> )">Remove from Watch list</button> | |
<a href="<?php echo get_site_url(); ?>/member-area/my-deals/" ng-show="checkdeal == 1" class="btn btn-default">Contact User</a> | |
<?php if($jsonreturn["wpcf_listing_type"] == 'Selling'){ ?> | |
<button ng-show="checkdeal == 0" ng-click="newdeal()">Create New Deal</button> | |
<a href="<?php echo get_site_url(); ?>/member-area/my-deals/" ng-show="checkdeal == 1" >View your deals</a> | |
<?php | |
echo "<pre>"; | |
var_dump($jsonreturn); | |
echo "</pre>"; | |
}else{ ?> | |
<?php } ?> | |
</div> | |
<div ng-cloak class="addealinfo" ng-hide="extrainfo"> | |
<centered> | |
<div class="contactform addinfoinner"> | |
<p class="closethis" ng-click="closethis()">x</p> | |
<div id="clientform"> | |
<form action="<?php bp_messages_form_action('compose' ); ?>/compose" method="post" id="send_message_form" class="standard-form" role="main" enctype="multipart/form-data"> | |
<?php do_action( 'bp_before_messages_compose_content' ); ?> | |
<?php bp_message_get_recipient_tabs(); ?> | |
<input type="hidden" name="send-to-input" class="send-to-input" id="send-to-input" value="<?php the_author_meta( 'user_login' ); ?>"/> | |
<label for="subject"><?php _e( 'Subject', 'buddypresns' ); ?></label> | |
<input type="text" name="subject" id="subject" value="<?php get_the_title(); ?>" /> | |
<label for="content"><?php _e( 'Message', 'buddypress' ); ?></label> | |
<textarea name="content" id="message_content" rows="15" cols="40"><?php bp_messages_content_value(); ?></textarea> | |
<input type="hidden" name="send_to_usernames" id="send-to-usernames" value="<?php bp_message_get_recipient_usernames(); ?>" class="<?php bp_message_get_recipient_usernames(); ?>" /> | |
<?php do_action( 'bp_after_messages_compose_content' ); ?> | |
<div class="submit"> | |
<input type="submit" value="<?php esc_attr_e( "Send Message", 'buddypress' ); ?>" name="send" id="send" /> | |
</div> | |
<?php wp_nonce_field( 'messages_send_message' ); ?> | |
</form> | |
<script type="text/javascript"> | |
document.getElementById("send-to-input").focus(); | |
</script> | |
</div> | |
</div> | |
</centered> | |
</div> | |
<?php | |
endwhile;// end of the loop. | |
}// end of user check | |
else{ | |
echo "<p> you need to be a user to be here</p>"; | |
} | |
?> | |
</div> | |
<div class="col-md-4"> | |
<div id="sidebar" style=""><?php dynamic_sidebar( 'avada-custom-sidebar-advertiserssidebar' ); ?></div> | |
</div> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment