Exemplo n.º 1
0
 public function actionDashboard()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->getState('parent_id')) {
             $this->redirect(array('parents/parent/studentprofile?id=' . Yii::app()->user->getState('stud_id')));
         }
         if (Yii::app()->user->getState('emp_id')) {
             $read = array();
             $unread = array();
             $read = EmployeeNotification::loadReadNotice();
             $count = count($read) + count($unread);
             $pages = new CPagination($count);
             $pages->pageSize = 10;
             $this->render('newdashboard', array('read' => $read, 'pages' => $pages));
         } else {
             if (Yii::app()->user->getState('stud_id')) {
                 $read = array();
                 $unread = array();
                 $read = StudentNotification::loadReadNotice();
                 $count = count($read) + count($unread);
                 $pages = new CPagination($count);
                 $pages->pageSize = 10;
                 $this->render('newdashboard', array('read' => $read, 'pages' => $pages));
             } else {
                 $this->render('newdashboard');
             }
         }
     } else {
         $this->redirect(array('login'));
     }
 }
Exemplo n.º 2
0
      public function loadReadNotice()
      {
	$res = array();
	$emp_trans = EmployeeTransaction::model()->findAll(array('select'=>'employee_transaction_user_id'));
	$s=0;
	if($emp_trans)
	{
		$d = CHtml::listData($emp_trans,'employee_transaction_user_id','employee_transaction_user_id');
		$s = implode(',',$d);
	}
	
	$list = EmployeeNotification::model()->findAll(array('limit'=>10,'order'=>'id  desc','condition'=>'emp_notice_to = :to AND alert_after_date <= :afterdate AND alert_before_date >= :beforedate and t.from IN('.$s.')', 'params'=> array(':to' => Yii::app()->user->getState('emp_id'), ':afterdate'=>date('Y-m-d'),':beforedate'=>date('Y-m-d'))));
	$menu = null;
	
	foreach($list as $notice) {
        $usertype=User::model()->findByPk($notice->from)->user_type;
	$menu .= '<div class="notify-data">';
	if($usertype=="employee")
	{		
	  $tran=EmployeeTransaction::model()->findByAttributes(array('employee_transaction_user_id'=>$notice->from));
		
	  $emp_model = EmployeeInfo::model()->findByAttributes(array('employee_info_transaction_id'=>$tran->employee_transaction_id));
	  $photo=EmployeePhotos::model()->findByPk($tran['employee_transaction_emp_photos_id']);
	  $menu .= '<span class="userimage">';
	  if(file_exists(Yii::app()->baseUrl.'/college_data/emp_images/'.$photo->employee_photos_path))
	  $user_image = Yii::app()->baseUrl.'/college_data/emp_images/'.$photo->employee_photos_path;
	  else
	  $user_image = Yii::app()->baseUrl.'/college_data/emp_images/no-images';

	  $menu .= CHtml::image($user_image,"No Image",array("width"=>"50px","height"=>"50px"));
	  $menu .='</span><span class="username">'; 
	  $menu .= ucfirst(strtolower($emp_model->employee_first_name)).' '.ucfirst(strtolower($emp_model->employee_last_name)).'</span>';
	 
 	}
	else 
        {  
	  $tran=StudentTransaction::model()->findByAttributes(array('student_transaction_user_id'=>$notice->from));
	  $stud_model = StudentInfo::model()->findByAttributes(array('student_info_transaction_id'=>$tran->student_transaction_id));
		
	  $photo=StudentPhotos::model()->findByPk($tran['student_transaction_student_photos_id']);
	
    	   $menu .= '<span class="userimage">';
	   if(file_exists(Yii::app()->baseUrl.'/college_data/stud_images/'.$photo->student_photos_path))
	   $user_image = Yii::app()->baseUrl.'/college_data/stud_images/'.$photo->student_photos_path;
	  else
	  $user_image = Yii::app()->baseUrl.'/college_data/emp_images/no-images';
	  $menu .= CHtml::image($user_image,"No Image",array("width"=>"50px","height"=>"50px"));
 	
	   $menu .='</span><span class="username">'; 
	 $menu .= ucfirst(strtolower($stud_model->student_first_name))." ".ucfirst(strtolower($stud_model->student_last_name))." (".$stud_model->student_enroll_no.")</span>";
	 }
 	  $menu .='<div class="notificationlink">';
	  $menu .='<a href='.Yii::app()->request->baseUrl.'/notification/employeeNotification/Read?id='.$notice->id.'>';
	  $menu .=$notice->title.'</a></div></div>';
 
	}

	if(!empty($list))
	$menu .='<span class="view-more-notice">'.CHtml::link('View More..','../notification/employeeNotification/index').'</span>';
	return $menu;

      }
	   public function actionAjaxRequest()
	    {
		$res = array();
		$list = EmployeeNotification::model()->findAll(array('condition'=>'emp_notice_to = :notify_to AND alert_after_date <= :afterdate AND alert_before_date >= :beforedate AND employee_notification_read = :read AND employee_notification_type <> "Leave" AND employee_notification_type <> "Leave Applied" AND employee_notification_type <> "Leave Cancel"', 'params'=> array(':notify_to' => Yii::app()->user->getState('emp_id'), ':afterdate'=>date('Y-m-d'),':beforedate'=>date('Y-m-d'), ':read' => 0)));
		$res['count'] = count($list);
		$menu = null;
		foreach($list as $notice) {
		  $menu .= '<div class="comment_ui">';
                  $menu .='<a href='.Yii::app()->request->baseUrl.'/notification/employeeNotification/Read?id='.$notice->id.'>';
                  //$menu .='<div style="position: relative;cursor:pointer;">';
                  $menu .=$notice->title.'</a></div>';

		}
		$res['details'] = $menu;
		echo json_encode($res);
	    }
Exemplo n.º 4
0
<?php
$this->breadcrumbs=array(
	'Employee Notifications',
);
?>

<h1>Employee Notifications</h1>

<div id="notifications" class="box-content" >
	  <?php echo EmployeeNotification::loadAllNotice($notices);?>
</div>

<?php $this->widget('ext.yiinfinite-scroll.YiinfiniteScroller', array(
    'contentSelector' => '#notifications',
    'itemSelector' => 'div.notifiche',
    'loadingText' => 'Loading...',
    'donetext' => 'All notices are loaded.',
    'pages' => $pages,
)); ?>


<?php /*$this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
	'summaryText'=>'',
	'cssFile'=>Yii::app()->request->baseUrl.'/css/newdashboard.css',
	'pager'=>array(
		'class'=>'AjaxList',
		'maxButtonCount'=>count($dataProvider),
		'header'=>''
	    ),
 <?php 
if (Yii::app()->user->getState('emp_id')) {
    $notifiche = EmployeeNotification::model()->getAllNotifications();
    ?>
                <?php 
    $notifications = array();
    ?>
		<?php 
    $lnotifications = array();
    ?>
                <?php 
    $count = 0;
    ?>
		<?php 
    $count1 = 0;
    ?>
                <?php 
    foreach ($notifiche as $notifica) {
        if ($notifica->isNotReaded()) {
            if ($notifica->employee_notification_type == "Leave") {
                $count1++;
                $lnotifications[$notifica->id] = $notifica->title;
            } else {
                $count++;
                $notifications[$notifica->id] = $notifica->title;
            }
        }
    }
}
if (Yii::app()->user->getState('stud_id')) {
    $notifiche = StudentNotification::model()->getAllNotifications();