Invalid output / Error

I want to make student website. student can login to see them standart list, edit, and delate it. I succeed to make student login. I just edited the code but the error was different. the error : will be displaying “0 standart” even though the student have at least 1 standart list.

this is my controller

        public function admin_dashboard(){
	$this->set('title_for_layout','Dashboard');
	
	$role_id = $this->Auth->user('role_id');
	$this->set('role_id',$role_id);
	//die;
	
	$this->User->bindModel(array(
					'belongsTo'=>array(
						'Standard'=>array(
							'className'=>'Standard'
						)
					)
	),false);
	// pr($this->params);die;
	if (!isset($this->params['named']['page'])) 
	{
        $this->Session->delete('AdminSearch');
    }
	
	$email = '';
	$first_name = '';
	$role_id = '';
	$standard_id = '';
	$status = '';
	$filters	=	'';
    if (!empty($this->request->data)) {
		$this->Session->delete('AdminSearch');
		if (isset($this->request->data['User']['first_name']) && $this->request->data['User']['first_name'] != '') 
		{
            $first_name = trim($this->request->data['User']['first_name']);
            $this->Session->write('AdminSearch.first_name', $first_name);				
        }
		if (isset($this->request->data['User']['email']) && $this->request->data['User']['email'] != '') 
		{
            $email = trim($this->request->data['User']['email']);
            $this->Session->write('AdminSearch.email', $email);				
        }
		if (isset($this->request->data['User']['role_id']) && $this->request->data['User']['role_id'] != '') 
		{
            $role_id = trim($this->request->data['User']['role_id']);
            $this->Session->write('AdminSearch.role_id', $role_id);				
        }
		if (isset($this->request->data['User']['standard_id']) && $this->request->data['User']['standard_id'] != '') 
		{
            $standard_id = trim($this->request->data['User']['standard_id']);
            $this->Session->write('AdminSearch.standard_id', $standard_id);				
        }
		if (isset($this->request->data['User']['status']) && $this->request->data['User']['status'] != '') 
		{
            $status = trim($this->request->data['User']['status']);
            $this->Session->write('AdminSearch.status', $status);				
        }
	}
	
	if ($this->Session->check('AdminSearch')) 
	{
        $keywords 	= 	$this->Session->read('AdminSearch');
		foreach($keywords as $key=>$values)
		{
			if($key == 'email')
			{
				$email = $values;
				$filters[] = array('User.'.$key.' LIKE'=>"%".$values."%");					
			}
			if($key == 'first_name')
			{
				$first_name = $values;
				$filters[] = array('User.'.$key.' LIKE'=>"%".$values."%");					
			}
			if($key == 'role_id')
			{
				$role_id = $values;
				$filters[] = array('User.role_id'=>$this->Session->read('AdminSearch.role_id'));
			}
			if($key == 'standard_id')
			{
				$standard_id = $values;
				$filters[] = array('User.standard_id'=>$this->Session->read('AdminSearch.standard_id'));
			}
			if($key == 'status')
			{
				$status = $values;
				$filters[] = array('User.status'=>$this->Session->read('AdminSearch.status'));
			}
		}
	}
	$this->paginate = array('User' => array(
		'limit' =>Configure::read('App.PageLimit'),
		'order' => array('User.id' => 'DESC'),
		'conditions' => $filters,
    ));	
	
	$data = $this->paginate('User');
	// pr($data);die;
	$this->loadModel('Standard');
	$standards	=	$this->Standard->getStandardList();
	$this->set(compact('standards'));
	$this->set(compact('data','status','email','first_name','role_id','standard_id'));
	$this->set('title_for_layout', __('User', true));
}

this is my code student_dashboard.ctp

                      <!-- Content Header (Page header) -->
		<?php 
			$permitted_module = $this->General->CheckIsPermitted($this->Session->read('Auth.User.id'),'user_manager');
			$admin_role_id = $this->Session->read('Auth.User.role_id');
			// pr($permitted_module);die;
		?>
            <section class="content-header">
                <h1>
                    Dashboard
                    <small>Control panel</small>
                </h1>
                <ol class="breadcrumb">
                   <?php echo ($this->Element('Admin/ele_dash_link'));?>
                    <li class="active">Dashboard</li>
                </ol>
            </section>
			
            <!-- Main content -->
            <section class="content">
                <!-- Small boxes (Stat box) -->
                <div class="row">

                    <?php if (!empty($data)) { ?>  
					<?php //if($permitted_module['ModulePermission']['standard_manager']) {	?>

					<div class="col-lg-3 col-xs-6">
                        <!-- small box -->
                        <div class="small-box bg-ferozi">
                            <?php foreach ($data as $value) { ?>
                            <div class="inner">
                                <h3>
                                    <?php   
                                    echo "&nbsp;&nbsp;";
                                    $standart_count = $this->General->GetAllotedSubject($value['User']['role_id']);
                                     echo ($standart_count);
                                     ?>
                                </h3>
                                <p>
                                    Standards
                                </p>
                            </div>
                            <div class="icon">
                                <i class="ion ion-document-text"></i>
                            </div>
                            <a class="small-box-footer" href="<?php echo Router::url(array('controller'=>'standards','action'=>'standard_list'))?>">
                                More info <i class="fa fa-arrow-circle-right"></i>
                            </a>
                            <?php } ?>
                        </div>
                    </div>
					<?php //} ?>
                    <?php } ?> 

                    <?php if (empty($data)) { ?>
                        <div class="col-lg-3 col-xs-6">
                        <!-- small box -->
                        <div class="small-box bg-ferozi">
                            <div class="inner">
                                <h3>
                                    0
                                </h3>
                                <p>
                                    You Have No Standard
                                </p>
                            </div>
                            <div class="icon">
                                <i class="ion ion-document-text"></i>
                            </div>
                            <div class="small-box-footer" style="padding-bottom:17px"> </div>
                        </div>
                    </div>
                    <?php } ?>  

                </div>                 
                <div class="row">
                    <div class="col-xs-12 connectedSortable">                            
                    </div>
                </div>   
			</section>

I have allot_subjects table in database. In allot_subjects table theres are column id, tutor_id, subject_id, standart_id and status.

This is Model AllotSubject.php

<?php // App::uses('AuthComponent', 'Controller/Component'); // App::uses('SessionComponent', 'Controller/Component'); App::uses('AppModel', 'Model'); class AllotSubject extends AppModel{ //public $primaryKey = '_id'; /** * Model name * @var string * @access public */ var $name = 'AllotSubject'; /** * Behaviors used by the Model * * @var array * @access public */ var $actsAs = array( 'Multivalidatable' ); var $validationSets = array( 'add'=> array( 'standard_id'=>array( 'R1'=>array( 'rule'=>'notEmpty', 'message' => 'Standard is required.' ) ), 'subject_id'=>array( 'R1'=>array( 'rule'=>'notEmpty', 'message' => 'Subject is required.' ) ), ), ); } This is my genereal file GeneralHelper.php > function GetAllotedSubject($tutor_id) > { > $allotObj = ClassRegistry::init('AllotSubject'); > $subject_count = $allotObj->find('count',array('conditions'=>array('AllotSubject.tutor_id'=>$tutor_id))); > $standart_count = $allotObj->find('count',array('conditions'=>array('AllotSubject.tutor_id'=>$tutor_id))); > return $standart_count; > return $subject_count; > }