<?php
if (!defined('ABSPATH')) exit();
if (!class_exists('CertificatesUlp')):
class CertificatesUlp extends CustomPostTypeUlp{
	/*
	 * @var string
	 */
	protected $post_type_slug = 'ulp_certificate';
	/*
	 * @var int
	 */
	protected $menu_position = 6;
	public function __construct(){
		$this->labels = array(
								    'name'               => __('Certificates', 'ulp'),
								    'singular_name'      => __('Certificate', 'ulp'),
								    'add_new'            => __('Add new Certificate', 'ulp'),
								    'add_new_item'       => __('Add new Certificate', 'ulp'),
								    'edit_item'          => __('Edit Certificate', 'ulp'),
								    'new_item'           => __('New Certificate', 'ulp'),
								    'all_items'          => __('All Certificates', 'ulp'),
								    'view_item'          => __('View Certificate', 'ulp'),
								    'search_items'       => __('Search Certificate', 'ulp'),
								    'not_found'          => '',
								    'not_found_in_trash' => '',
								    'parent_item_colon'  => '',
								    'menu_name'          => __('Certificates', 'ulp'),
		);
		$this->taxonomy_labels = array(
						'name'              => __('Certificate Categories', 'ulp'),
						'singular_name'     => __('Certificate Category', 'ulp'),
						'search_items'      => __('Search Certificate Category', 'ulp'),
						'all_items'         => __('Certificate Categories', 'ulp'),
						'parent_item'       => '',
						'parent_item_colon' => '',
						'edit_item'         => __('Edit', 'ulp'),
						'update_item'       => __('Update', 'ulp'),
						'add_new_item'      => __('Add new certificate category', 'ulp'),
						'new_item_name'     => __('Add new certificate category', 'ulp'),
						'menu_name'         => __('Certificate Categories', 'ulp'),
		);
		$this->taxonomy_slug = 'ulp_certificate_categories';
		$this->metaBoxes[] = array(
												'slug' => 'constantsBox',
												'title' => __('Ultimate Learning Pro - Constants', 'ulp'),
												'callback' => array($this, 'constantsBox'),
												'context' => 'normal', // normal || side || advanced
												'priority' => 'high', /// high || low
		);
		$this->run(); /// from parent class
	}
	/*
	 * @param none
	 * @return array
	 */
	protected function allMetaNames(){
		return array();
	}
	/**
	 * @param int
	 * @return none
	 */
	public function afterSavePost($post_id=0){}
		public function constantsBox(){
				$data = DbUlp::user_constants();
				$data = $data + [
						"{grade}" => '',
						'{course_name}' => '',
						'{obtained_date}' => '',
				];
				echo '
					<div class="ulp-inside-item">
  					  <div class="row">
   						<div class="col-xs-6">
						<p>'.__('Use the following constants to built your Certificate Template:', 'ulp').'</p>
				';
				foreach ($data as $key => $value){
					echo $key .'</br>';
				}
				echo '
				  	   </div>
					  </div>
					 </div>
				  ';
		}
}
endif;
