Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- session_start();
- ?>
- <?php get_header();
- //Pagination Class
- class pagination
- {
- /**
- * Properties array
- * @var array
- * @access private
- */
- private $_properties = array();
- /**
- * Default configurations
- * @var array
- * @access public
- */
- public $_defaults = array(
- 'page' => 1,
- 'perPage' => 20
- );
- /**
- * Constructor
- *
- * @param array $array Array of results to be paginated
- * @param int $curPage The current page interger that should used
- * @param int $perPage The amount of items that should be show per page
- * @return void
- * @access public
- */
- public function __construct($array, $curPage = null, $perPage = null)
- {
- $this->array = $array;
- $this->curPage = ($curPage == null ? $this->defaults['page'] : $curPage);
- $this->perPage = ($perPage == null ? $this->defaults['perPage'] : $perPage);
- }
- /**
- * Global setter
- *
- * Utilises the properties array
- *
- * @param string $name The name of the property to set
- * @param string $value The value that the property is assigned
- * @return void
- * @access public
- */
- public function __set($name, $value)
- {
- $this->_properties[$name] = $value;
- }
- /**
- * Global getter
- *
- * Takes a param from the properties array if it exists
- *
- * @param string $name The name of the property to get
- * @return mixed Either the property from the internal
- * properties array or false if isn't set
- * @access public
- */
- public function __get($name)
- {
- if (array_key_exists($name, $this->_properties)) {
- return $this->_properties[$name];
- }
- return false;
- }
- /**
- * Set the show first and last configuration
- *
- * This will enable the "<< first" and "last >>" style
- * links
- *
- * @param boolean $showFirstAndLast True to show, false to hide.
- * @return void
- * @access public
- */
- public function setShowFirstAndLast($showFirstAndLast)
- {
- $this->_showFirstAndLast = $showFirstAndLast;
- }
- /**
- * Set the main seperator character
- *
- * By default this will implode an empty string
- *
- * @param string $mainSeperator The seperator between the page numbers
- * @return void
- * @access public
- */
- public function setMainSeperator($mainSeperator)
- {
- $this->mainSeperator = $mainSeperator;
- }
- /**
- * Get the result portion from the provided array
- *
- * @return array Reduced array with correct calculated offset
- * @access public
- */
- public function getResults()
- {
- // Assign the page variable
- if (empty($this->curPage) !== false) {
- $this->page = $this->curPage; // using the get method
- } else {
- $this->page = 1; // if we don't have a page number then assume we are on the first page
- }
- // Take the length of the array
- $this->length = count($this->array);
- // Get the number of pages
- $this->pages = ceil($this->length / $this->perPage);
- // Calculate the starting point
- $this->start = ceil(($this->page - 1) * $this->perPage);
- // return the portion of results
- return array_slice($this->array, $this->start, $this->perPage);
- }
- /**
- * Get the html links for the generated page offset
- *
- * @param array $params A list of parameters (probably get/post) to
- * pass around with each request
- * @return mixed Return description (if any) ...
- * @access public
- */
- public function getLinks($params = array())
- {
- // Initiate the links array
- $plinks = array();
- $links = array();
- $slinks = array();
- // Concatenate the get variables to add to the page numbering string
- $queryUrl = '';
- if (!empty($params) === true) {
- unset($params['page']);
- $queryUrl = '&'.http_build_query($params);
- }
- // If we have more then one pages
- if (($this->pages) > 1) {
- // Assign the 'previous page' link into the array if we are not on the first page
- if ($this->page != 1) {
- if ($this->_showFirstAndLast) {
- $plinks[] = ' <a href="?page=1'.$queryUrl.'">«« First </a> ';
- }
- $plinks[] = ' <a href="?page='.($this->page - 1).$queryUrl.'">« Prev</a> ';
- }
- // Assign all the page numbers & links to the array
- for ($j = 1; $j < ($this->pages + 1); $j++) {
- if ($this->page == $j) {
- $links[] = ' <a class="selected">'.$j.'</a> '; // If we are on the same page as the current item
- } else {
- $links[] = ' <a href="?page='.$j.$queryUrl.'">'.$j.'</a> '; // add the link to the array
- }
- }
- // Assign the 'next page' if we are not on the last page
- if ($this->page < $this->pages) {
- $slinks[] = ' <a href="?page='.($this->page + 1).$queryUrl.'"> Next » </a> ';
- if ($this->_showFirstAndLast) {
- $slinks[] = ' <a href="?page='.($this->pages).$queryUrl.'"> Last »» </a> ';
- }
- }
- // Push the array into a string using any some glue
- return implode(' ', $plinks).implode($this->mainSeperator, $links).implode(' ', $slinks);
- }
- return;
- }
- }
- ?>
- <script type="text/javascript" src="<?php echo bloginfo( 'template_directory' ); ?>/js/jquery.members.js"></script>
- <div id="bodyMain">
- <?php
- ?>
- <div class="content">
- <div class="leftBody">
- <!--<div class="img"></div>-->
- <div class="singleContent">
- <?php
- if (have_posts()) : while (have_posts()) : the_post();
- ?>
- <div>
- <?php if(is_user_logged_in()) { ?>
- <form action="<?php the_permalink(); ?>" method="post">
- <div class="fieldSep">
- <div id="KeywordSearch"> <b>Name:</b> <br />
- <input type="text" name="key_search" class="inputtxtbox" value="<?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH') echo $_POST['key_search']; ?>" />
- </div>
- <div id="State"><b>State:</b><br />
- <select name="stateList">
- <!--<option value="State" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='State') {?> selected="selected" <?php }?>>State</option>-->
- <option value="Any" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='Any') {?> selected="selected" <?php }?>>Any</option>
- <option value="NSW" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='NSW') {?> selected="selected" <?php }?>>NSW</option>
- <option value="VIC" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='VIC') {?> selected="selected" <?php }?>>VIC</option>
- <option value="QLD" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='QLD') {?> selected="selected" <?php }?>>QLD</option>
- <option value="SA" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='SA') {?> selected="selected" <?php }?>>SA</option>
- <option value="WA" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='WA') {?> selected="selected" <?php }?>>WA</option>
- <option value="NT" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='NT') {?> selected="selected" <?php }?>>NT</option>
- <option value="ACT" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='ACT') {?> selected="selected" <?php }?>>ACT</option>
- <option value="TAS" <?php if(isset($_POST['searchMem']) && $_POST['stateList']=='TAS') {?> selected="selected" <?php }?>>TAS</option>
- </select>
- </div>
- </div>
- <div class="clear"></div>
- <div class="fieldSep">
- <div style="line-height:26px;"> <b>Experience: </b> <br />
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="f_film" value="Featured Film" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['f_film'] == 'Featured Film' ) {?> checked="checked" <?php } ?> />
- Feature Film</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="docum" value="Documentary" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['docum'] == 'Documentary' ) {?> checked="checked" <?php } ?>/>
- Documentary</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="tel_drama" value="Television Drama" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['tel_drama'] == 'Television Drama' ) {?> checked="checked" <?php } ?>/>
- Television Drama</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="tel_non_drama" value="Television Non-Drama" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['tel_non_drama'] == 'Television Non-Drama' ) {?> checked="checked" <?php } ?>/>
- Television Non-Drama</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="commercial" value="Commercial" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['commercial'] == 'Commercial' ) {?> checked="checked" <?php } ?>/>
- Commercial</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="s_film" value="Short Film" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['s_film'] == 'Short Film' ) {?> checked="checked" <?php } ?>/>
- Short Film</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="m_video" value="Music Video" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['m_video'] == 'Music Video' ) {?> checked="checked" <?php } ?>/>
- Music Video</div>
- <div class="clear"></div>
- </div>
- </div>
- <div class="fieldSep">
- <div style="line-height:26px;"> <b>Role:</b> <br />
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="editor" value="Editor" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['editor'] == 'Editor' ) {?> checked="checked" <?php } ?> />
- Editor</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="assis_editor" value="Assistant Editor" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['assis_editor'] == 'Assistant Editor' ) {?> checked="checked" <?php } ?> />
- Assistant Editor</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="online_editor" value="Online Editor" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['online_editor'] == 'Online Editor' ) {?> checked="checked" <?php } ?> />
- Online Editor</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="post_supervise" value="Post-Production Supervisor" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['post_supervise'] == 'Post-Production Supervisor' ) {?> checked="checked" <?php } ?> />
- Post Supervisor</div>
- <div class="clear"> </div>
- </div>
- </div>
- <div class="fieldSep">
- <div style="line-height:26px;"> <b>Membership:</b> <br />
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="life" value="member_life" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['life'] == 'member_life' ) {?> checked="checked" <?php } ?> />
- Life</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="full" value="member_full" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['full'] == 'member_full' ) {?> checked="checked" <?php } ?> />
- Full</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="accredited" value="member_accredited" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['accredited'] == 'member_accredited' ) {?> checked="checked" <?php } ?>/>
- Accredited</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="associate" value="member_associate" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['associate'] == 'member_associate' ) {?> checked="checked" <?php } ?>/>
- Associate</div>
- <div id="SelcetIcon">
- <input type="checkbox" class="styled" name="student" value="student" <?php if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH' && $_POST['student'] == 'student' ) {?> checked="checked" <?php } ?> />
- Student</div>
- <div class="clear"> </div>
- </div>
- </div>
- <input type="submit" value="SEARCH" name="search" class="searchbtn" />
- <input type="hidden" value="searchMem" name="searchMem" />
- </form>
- <?php }?>
- </div>
- <div class="clear"> </div>
- <div id="membersList">
- <?php
- if(isset($_POST['searchMem']) && $_POST['search']=='SEARCH') {
- if(!empty($_POST['key_search']) || !empty($_POST['f_film']) || !empty($_POST['docum']) || !empty($_POST['tel_drama']) || !empty($_POST['tel_non_drama']) || !empty($_POST['s_film'])||!empty($_POST['commercial'])||!empty($_POST['m_video'])||!empty($_POST['editor'])||!empty($_POST['assis_editor'])||!empty($_POST['online_editor'])||!empty($_POST['post_supervise'])|| $_POST['stateList'] != 'Any' || !empty($_POST['life']) || !empty($_POST['full']) || !empty($_POST['accredited']) || !empty($_POST['associate']) || !empty($_POST['student'])) {
- if( (isset($_POST['key_search']) || ($_POST['stateList'] != 'Any')) || (isset($_POST['f_film']) || isset($_POST['docum']) || isset($_POST['tel_drama'])|| isset($_POST['tel_non_drama']) || isset($_POST['s_film']) || isset($_POST['commercial']) || isset($_POST['m_video'])) || (isset($_POST['editor']) || isset($_POST['assis_editor']) || isset($_POST['online_editor']) || isset($_POST['post_supervise'])) || (isset($_POST['life']) || isset($_POST['full']) || isset($_POST['accredited']) || isset($_POST['associate']) || isset($_POST['student']))) {
- $r = $wpdb->get_col("select meta_value from $wpdb->usermeta WHERE `meta_key` = 'mgm_member_options'");
- $total_items = 0;
- ?>
- <div class="memberLabel"> <b>MEMBER</b> </div>
- <?php
- foreach ( $r as $urR ) :
- $unserialize_meta = unserialize($urR);
- if(($unserialize_meta['membership_type'] == 'member_full' || $unserialize_meta['membership_type'] == 'member_associate' || $unserialize_meta['membership_type'] == 'member_accredited' || $unserialize_meta['membership_type'] == 'member_life' || $unserialize_meta['membership_type'] =='member_life_accredited') && $unserialize_meta['status'] == 'Active') {
- if(is_array($unserialize_meta['custom_fields']['experience']) && is_array($unserialize_meta['custom_fields']['role']) ) {
- $user_id = get_userdata($unserialize_meta['id']);
- if( (($unserialize_meta['custom_fields']['state']== $_POST['stateList']) &&
- (strcasecmp($user_id->first_name,$_POST['key_search']) == 0) || (strcasecmp($user_id->last_name,$_POST['key_search']) == 0)) ||
- (($_POST['stateList']== 'Any') &&
- (strcasecmp($user_id->first_name,$_POST['key_search']) == 0) || (strcasecmp($user_id->last_name,$_POST['key_search']) == 0)) ||
- ((in_array($_POST['f_film'],$unserialize_meta['custom_fields']['experience']) || in_array($_POST['docum'],$unserialize_meta['custom_fields']['experience'])|| in_array($_POST['tel_drama'],$unserialize_meta['custom_fields']['experience'])|| in_array($_POST['tel_non_drama'],$unserialize_meta['custom_fields']['experience'])|| in_array($_POST['s_film'],$unserialize_meta['custom_fields']['experience'])|| in_array($_POST['commercial'],$unserialize_meta['custom_fields']['experience'])|| in_array($_POST['m_video'],$unserialize_meta['custom_fields']['experience'])) ||
- ( in_array($_POST['editor'],$unserialize_meta['custom_fields']['role']) || in_array($_POST['assis_editor'],$unserialize_meta['custom_fields']['role'])|| in_array($_POST['online_editor'],$unserialize_meta['custom_fields']['role'])|| in_array($_POST['post_supervise'],$unserialize_meta['custom_fields']['role']))
- || ($unserialize_meta['membership_type'] == $_POST['life']|| $unserialize_meta['membership_type'] == $_POST['full'] || $unserialize_meta['membership_type'] == $_POST['accredited'] || $unserialize_meta['membership_type']== $_POST['associate'] || $unserialize_meta['membership_type'] == $_POST['student']) )) {
- if($user_id->first_name != 'admin' || $user_id->last_name != 'admin' || $user_id->user_login != 'admin' || $user_id->first_name != '' || $user_id->last_name!= '') {
- $noMembers = 'noMembers';
- $member_id[] = $unserialize_meta['id'];
- }
- } else {
- $no_members = 'on';
- }
- }
- }
- endforeach;
- if ($no_members == 'on') {
- echo "<div class=".$noMembers." style=\"height:25px; padding:10px 0 0 5px;\">";
- echo "No Members Found.";
- echo "</div>";
- }
- foreach ($member_id as $member_id_value ) {
- $names[] = array(
- 'memberID' => $member_id_value,
- );
- }
- // If we have an array with items
- if (count($names)) {
- // Create the pagination object
- $pagination = new pagination($names, (isset($_GET['page']) ? $_GET['page'] : 1), 20);
- // Decide if the first and last links should show
- $pagination->setShowFirstAndLast(false);
- // You can overwrite the default seperator
- $pagination->setMainSeperator('');
- // Parse through the pagination class
- $memberPages = $pagination->getResults();
- $rowCount = 0;
- // If we have items
- if (count($memberPages) != 0) {
- // Create the page numbers
- $pageNumbers = '<div class="numbers">'.$pagination->getLinks($_GET).'</div>';
- // Loop through all the items in the array
- foreach ($memberPages as $memberArray) {
- $rowCount++;
- $user_id = get_userdata($memberArray['memberID']);
- if($rowCount%2==0) echo "<div style=\"background-color:#FFF; height:25px; padding:5px 0 0 5px;\">";
- else echo "<div style=\"height:25px; padding:5px 0 0 5px;\">";
- // Show the information about the item
- ?>
- <a href="<?php echo site_url(); ?>/author?authorname=<?php if (is_user_logged_in()) { echo $memberArray['memberID']; } ?>">
- <?php
- echo '<b>'.$user_id->first_name.'</b> <b>'.$user_id->last_name.'</b>';
- ?>
- </a>
- <?php
- if($rowCount%2==0) echo "</div>";
- else echo "</div>";
- }
- // print out the page numbers beneath the results
- echo '<div class="no_display"></div>';
- echo $pageNumbers;
- }
- }
- }
- } else {
- echo "No Fields Selected.";
- }
- } else {
- if(is_user_logged_in()) {
- ?>
- <div class="memberLabel"> <b>MEMBER</b> </div>
- <?php
- $r = $wpdb->get_col("select meta_value from $wpdb->usermeta WHERE `meta_key` = 'mgm_member_options'");
- $rowCount = 0;
- foreach ( $r as $urR ) :
- $unserialize_meta = unserialize($urR);
- if(($unserialize_meta['membership_type'] == 'member_full' || $unserialize_meta['membership_type'] == 'member_associate' || $unserialize_meta['membership_type'] == 'member_accredited' || $unserialize_meta['membership_type'] == 'member_life' || $unserialize_meta['membership_type'] =='member_life_accredited') && $unserialize_meta['status'] == 'Active') {
- $user_id = get_userdata($unserialize_meta['id']);
- if($user_id->first_name != 'admin' || $user_id->last_name != 'admin' || $user_id->user_login != 'admin' || $user_id->first_name != '' || $user_id->last_name!= '') {
- $rowCount++;
- $member_id[] = $unserialize_meta['id'];
- ?>
- <?php
- }
- }
- endforeach;
- foreach ($member_id as $member_id_value ) {
- $names[] = array(
- 'memberID' => $member_id_value,
- );
- }
- // If we have an array with items
- if (count($names)) {
- // Create the pagination object
- $pagination = new pagination($names, (isset($_GET['page']) ? $_GET['page'] : 1), 20);
- // Decide if the first and last links should show
- $pagination->setShowFirstAndLast(false);
- // You can overwrite the default seperator
- $pagination->setMainSeperator('');
- // Parse through the pagination class
- $memberPages = $pagination->getResults();
- $rowCount = 0;
- // If we have items
- if (count($memberPages) != 0) {
- // Create the page numbers
- $pageNumbers = '<div class="numbers">'.$pagination->getLinks($_GET).'</div>';
- // Loop through all the items in the array
- foreach ($memberPages as $memberArray) {
- $rowCount++;
- $user_id = get_userdata($memberArray['memberID']);
- if($rowCount%2==0) echo "<div style=\"background-color:#FFF; height:25px; padding:5px 0 0 5px;\">";
- else echo "<div style=\"height:25px; padding:5px 0 0 5px;\">";
- // Show the information about the item
- ?>
- <a href="<?php echo site_url(); ?>/author?authorname=<?php if (is_user_logged_in()) { echo $memberArray['memberID']; } ?>">
- <?php
- echo '<b>'.$user_id->first_name.'</b> <b>'.$user_id->last_name.'</b>';
- ?>
- </a>
- <?php
- if($rowCount%2==0) echo "</div>";
- else echo "</div>";
- }
- echo '<div class="no_display"></div>';
- // print out the page numbers beneath the results
- echo $pageNumbers;
- }
- }
- }
- }
- ?>
- </div>
- <?php
- // the_content();
- endwhile;
- endif;
- ?>
- </div>
- <!--</div> End of leftBody Class-->
- <div class="clear"></div>
- </div>
- <!--Changing Content End-->
- <div class="clear"></div>
- </div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement