<?php

add_action('hook_new_install','_newinstall');
function _newinstall(){ global $CORE, $wpdb;
 
 
// CONTENT LAYOUT / SINGLE LAYOUT
$GLOBALS['theme_defaults']['content_layout'] = "listing-joboard";
$GLOBALS['theme_defaults']['single_layout'] = "content-listing-joboard";

$GLOBALS['theme_defaults']['header_accountdetails'] = 1;

 
// HOME PAGE LAYOUT
$GLOBALS['theme_defaults']['homepage_layout'] = "layout-joboard1";

// DEFAULTS FOR HOME PAGE OBJECTS
$GLOBALS['theme_defaults']['hdata'] = array(
"j1" => array("title1" => "Job Board Theme", "title2" => "HTML5 Responsive Jobs Board Theme", "title3" => "Start your jobs board website today!", ),
"t1" => array("title1" => "Your Amazing Title Text Here", "title2" => "You can customize this area and enter your own title text via the admin area of the theme."  ),
"t2" => array("title1" => "Your Amazing Title Text Here", "title2" => "You can customize this area and enter your own title text via the admin area of the theme."  ),
);

// WEBSITE LOGO
$GLOBALS['theme_defaults']['logo_text1'] 	= "Website Logo";
$GLOBALS['theme_defaults']['logo_text2'] 	= "Your company slogan";
$GLOBALS['theme_defaults']['logo_icon'] 	= "2";





$GLOBALS['theme_defaults']['feedback_enable'] = 0;


 
 
// 4. DEFAULT TEMPLATE DATA
$GLOBALS['theme_defaults']['template'] 		= "template_joboard_theme";
 // SET HEADER
$GLOBALS['theme_defaults']['layout_header'] = 1;
// SET MENU
$GLOBALS['theme_defaults']['layout_menu'] = 3;

			
$GLOBALS['theme_defaults']['widgetobject']["3columns"]["0"] = array(
			"fullw" => "yes",
			
			"col1" => '<div class="panel panel-default">
            <div class="panel-heading"><h3>Welcome to our website</h3></div>
            <div class="panel-body">
			<h5>Your own text and images can be placed here.</h5>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.</p>
            <img src="'.get_template_directory_uri()."/templates/".$GLOBALS['theme_defaults']['template'].'/img/a1.jpg" alt="" class="wltatt_id" />
            </div></div>',
			
			"col2" => '<div class="panel panel-default">
            <div class="panel-heading"><h3>Upload your CV</h3></div>
            <div class="panel-body">
			<h5>Your own text and images can be placed here.</h5>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.</p>
            <img src="'.get_template_directory_uri()."/templates/".$GLOBALS['theme_defaults']['template'].'/img/a2.jpg" alt="" class="wltatt_id" />			
            </div></div>',
			
			"col3" => '<div class="panel panel-default">
            <div class="panel-heading"><h3>Job of the week</h3></div>
            <div class="panel-body">
			<h5>Your own text and images can be placed here.</h5>
			<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra varius quam sit amet vulputate.</p>
            <img src="'.get_template_directory_uri()."/templates/".$GLOBALS['theme_defaults']['template'].'/img/a3.jpg" alt="" class="wltatt_id" />
            </div></div>',
		);
 
$GLOBALS['theme_defaults']['widgetobject']["categoryblock"][1] = array(
		"image" => "no",
		"title" => "Jobs By Category", 
		"fullw" => "no",
		"subcats" => "3",
		"subcatcount" => "yes",
		"btnview" => "yes",
		"subcatempty" => "yes",
);



$GLOBALS['theme_defaults']['homepage'] 		= array("widgetblock1" => "3columns_0,categoryblock_1");
 

// HOME PAGE TEXT
update_option("job_home1","welcome to our website");
update_option("job_home2","This is a subheadline here");
update_option("job_home3","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tempus eleifend risus ut congue. Pellentesque nec lacus elit. Pellentesque convallis nisi ac augue pharetra eu tristique neque consequat. Mauris ornare tempor nulla, vel sagittis diam convallis eget.");


$GLOBALS['theme_defaults']['breadcrumbs_inner'] = 0;
$GLOBALS['theme_defaults']['layout_columns'] 	= array('style' => 'fixed',  '2columns' => '0', 'search' => 1, 'homepage' => 3, 'single' => 1, 'page' => 1, 'page_2columns' => 1, 'single_2columns' => 1, 'search_2columns' => 1, 'homepage_2columns' => 1);
 

$GLOBALS['theme_defaults']['itemcode'] 		= '[IMAGE]<span class="right hidden-xs hidden-sm hidden_details" style="padding-right:20px; text-align:right;line-height:30px">[JOBTYPE] <br />[FAVS]</span><div class="caption"><h1>[TITLE] [JOBSTATUS]</h1><div class="hidden_details"> [ICON id="map-marker"] [LOCATION]   [DISTANCE] <hr /> [EXCERPT]  <hr /><span class="right">[BUTTON] </span>[ICON id="fa fa-tags" fa=true] [CATEGORY] [TAGS]</div></div>';

update_option('wlt_reset_itemcode', $GLOBALS['theme_defaults']['itemcode']);

$GLOBALS['theme_defaults']['listingcode']		= '<div class="block"> <div class="block-content"><span class="right">[IMAGE]</span><h1><span>[TITLE-NOLINK] [JOBSTATUS]</span></h1><hr><ul><li>[ICON id="fa fa-group" fa=1] [hits] user views [ICON id="fa fa-comments" fa=1] [COMMENT_COUNT] comments </li> <li> [ICON id="map-marker"] [LOCATION]  </li><li> [DISTANCE]  </li> </ul>  <hr />[CONTENT][FILES][GOOGLEMAP]   <div class="clearfix"></div><hr /> [COMMENTS]</div></div>'; 

update_option('wlt_reset_listingcode', $GLOBALS['theme_defaults']['listingcode']);
 
 
// 5. REINSTALL THE SAMPLE DATA CATEGORIES 
$new_cat_array = array("Accounting"	 ,"General Business"	 ,"Other"
,"Admin & Clerical"	 ,"General Labor"	 ,"Pharmaceutical"
,"Automotive"	 ,"Government"	 
,"Banking"	 ,"Grocery"	 ,"Purchasing" ,"Procurement"
,"Biotech"	 ,"Health Care"	 ,"QA" ,"Quality Control"
,"Broadcast" ,"Journalism"	 ,"Hotel" ,"Hospitality"	 ,"Real Estate"	 ,"Human Resources"	 ,"Research"
,"Construction"	   ,"Restaurant" ,"Food Service"
,"Consultant"	 ,"Installation" ,"Maint" ,"Repair"	 ,"Reta"
,"Customer Service"	 ,"Insurance"	 ,"Sales"
,"Design"	 ,"Inventory"	 ,"Science"
,"Distribution" ,"Shipping"	 ,"Legal"	 ,"Skilled Labor" ,"Trades"
,"Education" ,"Teachin"	 ,"Legal Admin"	 ,"Strategy" ,"Planning"
,"Engineering"	 ,"Management"	 ,"Supply Chain"
,"Entry Level" ,"New Grad"	 ,"Manufacturing" 
,"Executive"	 ,"Marketing"	 ,"Training"
,"Facilities"	 ,"Media" ,"Journalism" ,"Newspaper"	 ,"Transportation"
,"Finance"	 ,"Nonprofit" ,"Social Services"	 ,"Warehouse");
 
$saved_cats_array = array(); $ff=1;
foreach($new_cat_array as $cat){
	if ( is_term( $cat , THEME_TAXONOMY ) ){	
		$term = get_term_by('slug', $cat, THEME_TAXONOMY);		 
		$nparent  = $term->term_id;
		$saved_cats_array[] = $term->term_id;	
	}else{
	
		$cat_id = wp_insert_term($cat, THEME_TAXONOMY, array('cat_name' => $cat ));
		if(!is_object($cat_id) && isset($cat_id['term_id'])){
		$saved_cats_array[] = $cat_id['term_id'];
		$nparent = $cat_id['term_id'];
		}else{
		$saved_cats_array[] = $cat_id->term_id;
		$nparent = $cat_id->term_id;
		}			
		// add in icon for this cat		
		//$GLOBALS['theme_defaults']['category_icon_'.$nparent] = THEME_URI."/templates/".$GLOBALS['theme_defaults']['template']."/img/c".$ff.".jpg";
		$ff++; 
	}
	 
}
// 6. INSTALL THE SAMPLE DATA LISTINGS
$posts_array = array(
"1" => array("name" =>"Deputy Manager","price" => "100", "bidcount" => "0", "hits" => "0", "author" => "1"),
"2" => array("name" =>"Legal Resourcer","price" => "130", "bidcount" => "0", "hits" => "0", "author" => "2"),
"3" => array("name" =>"Electrician / 17th Edition","price" => "150",  "bidcount" => "0", "hits" => "0", "author" => "3"),
"4" => array("name" =>"Door Supervisor","price" => "160",  "bidcount" => "0", "hits" => "0", "author" => "4"),
"5" => array("name" =>"Sales Manager","price" => "150", "bidcount" => "0", "hits" => "0", "author" => "5"),
"6" => array("name" =>"Sales Advisor","price" => "170", "bidcount" => "0", "hits" => "0", "author" => "6"),
"7" => array("name" =>"Support Assistant","price" => "200",  "bidcount" => "0", "hits" => "0", "author" => "7"),
"8" => array("name" =>"Web Developer","price" => "300",  "bidcount" => "0", "hits" => "0", "author" => "8"),
"9" => array("name" =>"Communications Manager","price" => "500", "bidcount" => "0", "hits" => "0", "author" => "9")

);

		$fields = array(
		"jobtype"			=> array('fulltime','parttime','contract','internship','temporary'),	 
		"displaytype" 		=> array(2,1),		 
		"pricetype" 		=> array(1,2,3,4),
		"price" 			=> array('10000','20000','30000','40000','50000','60000'),
 	
		);
		
foreach($posts_array as $np){
 
	$my_post = array();
	$my_post['post_author'] 	= $np['author'];
	$my_post['post_title'] 		= $np['name'];
	$my_post['post_content'] 	= "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tempus eleifend risus ut congue. Pellentesque nec lacus elit. Pellentesque convallis nisi ac augue pharetra eu tristique neque consequat. Mauris ornare tempor nulla, vel sagittis diam convallis eget.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tempus eleifend risus ut congue. Pellentesque nec lacus elit. Pellentesque convallis nisi ac augue pharetra eu tristique neque consequat. Mauris ornare tempor nulla, vel sagittis diam convallis eget.</p><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p><small>Someone famous <cite title='Source Title'>Source Title</cite></small>
</blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tempus eleifend risus ut congue. Pellentesque nec lacus elit. Pellentesque convallis nisi ac augue pharetra eu tristique neque consequat. Mauris ornare tempor nulla, vel sagittis diam convallis eget.</p><dl class='dl-horizontal'>
				<dt>Description lists</dt>
				<dd>A description list is perfect for defining terms.</dd>
				<dt>Euismod</dt>
				<dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
				<dd>Donec id elit non mi porta gravida at eget metus.</dd>
				<dt>Malesuada porta</dt>
				<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
				<dt>Felis euismod semper eget lacinia</dt>
				<dd>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</dd>
			  </dl>";
	$my_post['post_type'] 		= THEME_TAXONOMY."_type";
	$my_post['post_status'] 	= "publish";
	$my_post['post_category'] 	= "";
	$my_post['tags_input'] 		= "";
	$POSTID 					= wp_insert_post( $my_post );	
	
	add_post_meta($POSTID, "image", get_template_directory_uri()."/templates/".$GLOBALS['theme_defaults']['template']."/img/c".$np['author'].".png");
	 
	
	// ADD ON CUSTOM FIELDS
	foreach($fields as $k => $t){
		if(is_array($t)){		
		$ig = array_rand($t,1);
		add_post_meta($POSTID, $k, $t[$ig]);
		}else{
		add_post_meta($POSTID, $k, $t);
		}	
	}
	
	// UPDATE CAT LIST
	wp_set_post_terms( $POSTID, $saved_cats_array, THEME_TAXONOMY );		
} 









// CREATE 20 FAKE RESUMES
register_taxonomy( 'wlt_resume', 'cproduct_type', array( 'hierarchical' => true, 'labels' => array('name' => 'Resumes') , 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'resume') ) );  

$i=0;
while($i < 20){

				$my_post = array();
				$my_post['post_title'] 		= "Example Resume ".$i;
				$my_post['post_content'] 	= "";
				$my_post['post_excerpt'] 	= "";
				$my_post['post_status'] 	= "publish";
				$my_post['post_type'] 		= "wlt_resume";
				$my_post['post_author'] 	= $userdata->ID;
				$myresumeid					= wp_insert_post( $my_post );
			 	
				// UPDATE USER RESUME
				update_post_meta($myresumeid, 'resume0', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.');
				update_post_meta($myresumeid, 'resume1', 'Skill One, Skill Two, Skill Three, Skill Four, Skill Five, Skill Six, Skill Seven, Skill Eight, Skill Nine');
				update_post_meta($myresumeid, 'resume2', 'Master Degree

2018-2021

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.

University

2015-2018

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.

Primary School

2001-2015

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.');
				update_post_meta($myresumeid, 'resume3',  'My First Job

1960-2008

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.

Second Job

2008-2013

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua.');
				update_post_meta($myresumeid, 'resume4', 'Traveling

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua

Reading

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua

Books

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumyeirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diamvoluptua');


 

$i++;
}


} 

?>