public/wordpress/wp-content/plugins/wishlist-member-addon-for-wp-courseware/class_members.inc.php
/**
		 * Page that shows the overview of mapping for the levels to courses.
		 * @param PageBuilder $page The current page object.
		 */
Page that shows the overview of mapping for the levels to courses.
@param PageBuilder $page The current page object.
Page that shows the overview of mapping for the levels to courses . @param PageBuilder $page The current page object .
private function showMembershipMappingLevels_overview($page)
		{
			if (!$this->found_membershipTool())
			{
				$page->showPageFooter();
				return;
			}
			$levelData = $this->getMembershipLevels_cached();
			if ($levelData)
			{
				$table = new TableBuilder();
				$table->attributes = array('class' => 'wpcw_tbl widefat', 'id' => 'wpcw_members_tbl');
				$col = new TableColumn(__('Level ID', 'wp_courseware'), 'wpcw_members_id');
				$table->addColumn($col);
				$col = new TableColumn(__('Level Name', 'wp_courseware'), 'wpcw_members_name');
				$table->addColumn($col);
				$col = new TableColumn(__('Users with this level can access:', 'wp_courseware'), 'wpcw_members_levels');
				$table->addColumn($col);
				$col = new TableColumn(__('Actions', 'wp_courseware'), 'wpcw_members_actions');
				$table->addColumn($col);
				$odd = false;
				$baseURL = admin_url('admin.php?page=' . $this->extensionID);
				$courses = WPCW_courses_getCourseList(false);
				foreach ($levelData as $id => $levelDatum)
				{
					$data = array();
					$data['wpcw_members_id'] 		= $levelDatum['id'];
					$data['wpcw_members_name'] 		= $levelDatum['name'];
					$courseListInDB = $this->getCourseAccessListForLevel($levelDatum['id']);
					if ($courses)
					{
						$data['wpcw_members_levels']  = '<ul class="wpcw_tickitems">';
						foreach ($courses as $courseID => $courseName)
						{
							$data['wpcw_members_levels'] .= sprintf('<li class="wpcw_%s">%s</li>', (isset($courseListInDB[$courseID]) ? 'enabled' : 'disabled'), $courseName);							
						}
						$data['wpcw_members_levels'] .= '</ul>';
					}
					else {
						$data['wpcw_members_levels'] = __('There are no courses yet.', 'wp_courseware');	
					}
					$data['wpcw_members_actions'] 	= sprintf('<a href="%s&level_id=%s" class="button-secondary">%s</a>', 
						$baseURL, $levelDatum['id'], __('Edit Course Access Settings', 'wp_courseware')
					);					
					$odd = !$odd;
					$table->addRow($data, ($odd ? 'alternate' : ''));
				}
				echo $table->toString();
			}
			else {
				$page->showMessage(sprintf(__('No levels were found for %s.', 'wp_courseware'), $this->extensionName), true);
			}			
		}
private function showMembershipMappingLevels_overview ( $ page ) { if ( ! $ this -> found_membershipTool ( ) ) { $ page -> showPageFooter ( ) ; return ; } $ levelData = $ this -> getMembershipLevels_cached ( ) ; if ( $ levelData ) { $ table = new TableBuilder ( ) ; $ table -> attributes = array ( 'class' => 'wpcw_tbl widefat' , 'id' => 'wpcw_members_tbl' ) ; $ col = new TableColumn ( __ ( 'Level ID' , 'wp_courseware' ) , 'wpcw_members_id' ) ; $ table -> addColumn ( $ col ) ; $ col = new TableColumn ( __ ( 'Level Name' , 'wp_courseware' ) , 'wpcw_members_name' ) ; $ table -> addColumn ( $ col ) ; $ col = new TableColumn ( __ ( 'Users with this level can access:' , 'wp_courseware' ) , 'wpcw_members_levels' ) ; $ table -> addColumn ( $ col ) ; $ col = new TableColumn ( __ ( 'Actions' , 'wp_courseware' ) , 'wpcw_members_actions' ) ; $ table -> addColumn ( $ col ) ; $ odd = false ; $ baseURL = admin_url ( 'admin.php?page=' . $ this -> extensionID ) ; $ courses = WPCW_courses_getCourseList ( false ) ; foreach ( $ levelData as $ id => $ levelDatum ) { $ data = array ( ) ; $ data [ 'wpcw_members_id' ] = $ levelDatum [ 'id' ] ; $ data [ 'wpcw_members_name' ] = $ levelDatum [ 'name' ] ; $ courseListInDB = $ this -> getCourseAccessListForLevel ( $ levelDatum [ 'id' ] ) ; if ( $ courses ) { $ data [ 'wpcw_members_levels' ] = '<ul class="wpcw_tickitems">' ; foreach ( $ courses as $ courseID => $ courseName ) { $ data [ 'wpcw_members_levels' ] .= sprintf ( '<li class="wpcw_%s">%s</li>' , ( isset ( $ courseListInDB [ $ courseID ] ) ? 'enabled' : 'disabled' ) , $ courseName ) ; } $ data [ 'wpcw_members_levels' ] .= '</ul>' ; } else { $ data [ 'wpcw_members_levels' ] = __ ( 'There are no courses yet.' , 'wp_courseware' ) ; } $ data [ 'wpcw_members_actions' ] = sprintf ( '<a href="%s&level_id=%s" class="button-secondary">%s</a>' , $ baseURL , $ levelDatum [ 'id' ] , __ ( 'Edit Course Access Settings' , 'wp_courseware' ) ) ; $ odd = ! $ odd ; $ table -> addRow ( $ data , ( $ odd ? 'alternate' : '' ) ) ; } echo $ table -> toString ( ) ; } else { $ page -> showMessage ( sprintf ( __ ( 'No levels were found for %s.' , 'wp_courseware' ) , $ this -> extensionName ) , true ) ; } }
Page that shows the overview of mapping for the levels to courses.
Page that shows the overview of mapping for the levels to courses .
// Handle the detection of the membership plugin before doing anything else. // Try to show the level data // Create the table to show the data // Work out the base URL for the overview page  // The list of courses that are currently on the system. // Add actual level data // Get list of courses already associated with level. // Show which courses will be added to users created at this level. // No courses yet // Buttons to edit the permissions // Nothing found, show nice error message.