public function run($args)
 {
     $userModel = new UserModel();
     $pushMsgModel = new PushMsgModel();
     $url = Yii::app()->params['baiduPushUrl'];
     $apikey = Yii::app()->params['baiduPushApiKey'];
     $secret_key = Yii::app()->params['baiduPushSecretKey'];
     //此处替换为应用的secret key
     $data = array();
     $timestamp = time();
     //var_dump($users);exit;
     $leaguePushMsgModel = new LeaguePushMsgModel();
     //找到需要进行消息推送的球队
     $pushData = $leaguePushMsgModel->findPush(0, 1);
     //		var_dump($pushData);exit;
     $pushTeams = array();
     if (isset($pushData[0]->teams)) {
         $pushTeams = $pushData[0]->teams;
     }
     $content = '更新了赛程';
     $method = 'POST';
     $aps = array("alert" => "{$content}", "sound" => "1", "badge" => 1);
     $mess = array("title" => "更新了赛程", "description" => $content, "aps" => $aps);
     if (!empty($pushTeams)) {
         foreach ($pushTeams as $team) {
             $arrContent = array('method' => 'push_msg', 'apikey' => $apikey, 'push_type' => 2, 'tag' => $team, 'device_type' => 4, 'message_type' => 1, 'deploy_status' => 1, 'messages' => json_encode($mess), 'msg_keys' => '1', 'timestamp' => $timestamp, 'expires' => intval($timestamp) + 600);
             $sign = $this->genSign($secret_key, $method, $url, $arrContent);
             $arrContent['sign'] = $sign;
             //var_dump($arrContent);exit;
             $query = http_build_query($arrContent);
             //找到联赛中的球队
             $users = $userModel->findRowsByRelation("footballer", "Team", $team);
             if (!empty($users)) {
                 $saveBatchArr = array();
                 foreach ($users as $user) {
                     if (isset($user->username) && !empty($user->username)) {
                         $extra = array("belongId" => $user->username, "title" => "联赛赛程", "type" => 2, "time" => time(), "targetId" => $user->objectId, "subtype" => 19);
                         $saveArr = array('belongUsername' => $user->username, 'isRead' => 0, 'status' => 0, 'msgType' => 0, 'extra' => json_encode($extra), 'content' => $content);
                         array_push($saveBatchArr, $saveArr);
                         //记录球员接收的推送消息
                         //$result = $pushMsgModel->addPushMsg($saveArr);
                     }
                 }
                 $result = $pushMsgModel->saveBatch($saveBatchArr);
             }
             //var_dump($result);exit;
             //	echo $url.'?'.$query;exit;
             $res = CommonFunction::sendMobileMsg($url . '?' . $query, $data);
             //				$res = Yii::app()->CURL->run($url.'?'.$query,FALSE,$data);
         }
         var_dump($res);
         exit;
     }
 }
 public static function getDirContents($dir, &$results = array())
 {
     $files = scandir($dir);
     foreach ($files as $key => $value) {
         $path = realpath($dir . DIRECTORY_SEPARATOR . $value);
         if (!is_dir($path)) {
             $results[] = $path;
         } else {
             if (is_dir($path) && $value != "." && $value != "..") {
                 CommonFunction::getDirContents($path, $results);
                 $results[] = $path;
             }
         }
     }
     return $results;
 }
 public static function init()
 {
     spl_autoload_register(function ($class) {
         // remove vendor from the class path
         $position = stripos($class, "\\");
         $class = substr($class, $position);
         $class = str_replace('\\', '\\\\', $class);
         // find proper file for this class
         require_once 'CommonFunction.php';
         $dirs = CommonFunction::getDirContents($_SERVER['DOCUMENT_ROOT']);
         $classFile = array_filter($dirs, function ($dir) use($class) {
             $pattern = '/' . $class . '/';
             if (preg_match($pattern, $dir)) {
                 return $dir;
             }
         });
         // require the file if it is found
         $firstMatchedFile = array_pop($classFile);
         if (isset($firstMatchedFile)) {
             require_once $firstMatchedFile;
         }
     });
 }
Example #4
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['anli'])) {
         $model->attributes = $_POST['anli'];
         $anli = anli::model()->findByPk($id);
         $img = $_FILES['anli']['name']['image'];
         if ($img !== '') {
             $img = CUploadedFile::getInstance($model, 'image');
             $extensionName = explode('.', $img->getName());
             $extensionName = $extensionName[count($extensionName) - 1];
             $day_file = date('Y-m-d', time());
             $path = dirname(Yii::app()->basePath) . '/upload/case';
             CommonFunction::do_mkdir($day_file, $path);
             $time_path = date('Y', time()) . '/' . date('m', time()) . '/' . date('d', time()) . '-';
             $dir = dirname(Yii::app()->basePath) . '/upload/case/' . $time_path;
             $img_src = $dir . md5(time()) . '.' . $extensionName;
             $img1 = md5(time()) . '.' . $extensionName;
             $model->image = $time_path . $img1;
         } else {
             $model->image = $anli->image;
         }
         //$model->cate_id = $_POST['Caigou']['cate_id'];
         if ($model->save()) {
             if ($img !== '') {
                 @unlink(dirname(Yii::app()->basePath) . '/upload/case/' . $anli->image);
                 //$model->default_image->saveAs(dirname(Yii::app()->basePath) .'/upload/caigou/'.$pic_name,true);
                 $img->saveAs($img_src);
             }
             $this->redirect(array('/admin/case/admin'));
         }
     }
     $this->render('update', array('model' => $model));
 }
Example #5
0
?>
												<option value="">Select Checklist Name..</option>
												@foreach($options as $option)
												<option value="{{$option}}">{{$option}}</option>
												@endforeach
											</select>
											</div>
											
                    </div>
                    <div class="form-group ">
                                           
											{{Form::label('check_list_type', 'Check List Type', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											<select id="check_list_type" name='checklist_type' class="demo-default" placeholder="">
											<?php 
$options = CommonFunction::getChecklistType();
?>
												<option value="">Select Check List Type..</option>
												@foreach($options as $option)
												<option value="{{$option}}">{{$option}}</option>
												@endforeach
											</select>
											</div>
											
                    </div>
					
					<div class="form-group">
                       
                            <button type="submit" name='' value='' class="btn btn-primary btn-lg btn-block">Get Check List</button>
                       
                    </div>
Example #6
0
                                           
											{{Form::label('employees_speciality', 'Employee\'s Speciality', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::select('employees_speciality',[''=>'--  Select Speciality  --','OPS'=>'OPS','AIR'=>'AIR','ANS-AGA'=>'ANS-AGA','Others'=>'Others'],$info->employees_speciality,array('class'=>'form-control','required'=>''))}}
											</div>
											
                    </div>
                     <div class="form-group required">
                  									   <?php 
$date = CommonFunction::date($info->hire_date);
?>
														<?php 
$month = CommonFunction::month($info->hire_date);
?>
														<?php 
$year = CommonFunction::year($info->hire_date);
?>
	                                           
												{{Form::label('hire_date', 'Hire Date', array('class' => 'col-xs-4 control-label'))}}
												
														<div class="row">
															<div class="col-xs-2">
															{{Form::select('hire_date', $dates,$date,array('class'=>'form-control','required'=>''))}}
															</div>
															<div class="col-xs-3">
															{{Form::select('hire_month',$months,$month,array('class'=>'form-control','required'=>''))}}
												
																
															</div>
															<div class="col-xs-2">
																{{Form::select('hire_year',$years,$year,array('class'=>'form-control','required'=>''))}}
Example #7
0
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Add New Question</h4>
            </div>

            <div class="modal-body"> 
                              
				{{Form::open(array('url'=>'helpFaq/saveQuestion','method'=>'post','class'=>'form-horizontal','data-toggle'=>'validator','role'=>'form','files'=>'true'))}}
				  
					
                     
                    <div class="form-group required">
                                           
											{{Form::label('category', 'Category', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											<?php 
$options = CommonFunction::getOptions('helpFaq_categories');
?>
											<select required id="categories"  multiple name="categories[]" class="demo-default" placeholder="Select  Category...">
												<option value="">Select  Cat...</option>
												@foreach($options as $option)
												<option value="{{$option}}">{{$option}}</option>
												@endforeach
											</select>
											</div>
											
                    </div>
					<div class="form-group ">
                                           
											{{Form::label('question', 'Ask Question', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::textarea('question','', array('class' => 'form-control','placeholder'=>'','size'=>'4x1'))}}
							@endif		
						@endif			 
                <!-- /.box-header -->
					
					<div class="box-body">
					<div class='disNon'>
					{{$num=0}}
					</div>	
                    <table class="table table-bordered">
					@if($approvalInfos)
					@foreach($approvalInfos as $info)
                        <tbody>
						    <tr>               
								<th colspan='2' style='color:#72C2E6'>
								<?php 
$siaApproval = CommonFunction::programStatus($siaNumber);
?>
				
								@if($siaApproval==0)	
								<span class='hidden-print'>
									 @if('true'==CommonFunction::hasPermission('sc_issue_safety_concern',Auth::user()->emp_id(),'par_delete'))
										{{ HTML::linkAction('AircraftController@permanentDelete', 'P.D',array('sc_approval_info',$info->id), array('class' => 'glyphicon glyphicon-trash','style'=>'color:red;float:right;padding:5px;','onclick'=>" return confirm('Wanna Delete?')")) }}
									 @endif
									 @if('true'==CommonFunction::hasPermission('sc_issue_safety_concern',Auth::user()->emp_id(),'sof_delete'))
										{{ HTML::linkAction('AircraftController@softDelete', 'S.D',array('sc_approval_info',$info->id), array('class' => 'glyphicon glyphicon-trash','style'=>'color:red;float:right;padding:5px;','onclick'=>" return confirm('Wanna Delete?')")) }}
									 @endif
									@if('true'==CommonFunction::hasPermission('sc_issue_safety_concern',Auth::user()->emp_id(),'update'))
										 <a data-toggle="modal" data-target="#editapprovalInfos{{$info->id}}" href='' style='color:green;float:right;padding:5px;'>
											<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
										</a>
									 @endif
Example #9
0
															<?php 
$date = CommonFunction::date($info->target_date);
?>
															{{Form::select('date', $dates,$date,array('class'=>'form-control','required'=>''))}}
															</div>
															<div class="col-xs-3">
															<?php 
$month = CommonFunction::month($info->target_date);
?>
															{{Form::select('month',$months,$month,array('class'=>'form-control','required'=>''))}}
												
																
															</div>
															<div class="col-xs-2">
															<?php 
$year = CommonFunction::year($info->target_date);
?>
																{{Form::select('year',$years,$year,array('class'=>'form-control','required'=>''))}}
															</div>
														</div>
												
	                    </div>	
					
					
					
					<div class="form-group ">
                                           
											{{Form::label('corrective_action_plan', 'Correction Action Recommendation', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::textarea('corrective_action_plan',$info->corrective_action_plan, array('class' => 'form-control','placeholder'=>'',''=>'','size'=>'4x1'))}}
											</div>
Example #10
0
@extends('layout')
@section('content')

<section class='content ' >
<!--Instruction Start-->
 <?php 
$module = 'employee';
$instructions = CommonFunction::getModuleInstructions($module);
?>
  @include('commonInstruction')
  @yield('instruction')
<!--End Instruction-->
   
                      
						
						<div class="row">
					   
                    @if('true'==CommonFunction::hasPermission('emp_admin_list',Auth::user()->emp_id(),'access'))
                   
                        <div class="col-lg-3 col-xs-6 col-md-3 ">
                            <!-- small box -->
                            <div class="small-box bg-aqua ">
                                <div class="inner">
                                    <h4 class='title'>
                                        Notifications
                                    </h4>
                                    
                                </div>
                               
                                <a class="small-box-footer" href="{{URL::to('qualification/notification');}}">
                                    More info <i class="fa fa-arrow-circle-right"></i>
Example #11
0
                    <div class="form-group">
                                           
                                            {{Form::label('role','Role', array('class' => 'col-xs-4 control-label'))}}
                                            
                                             <div class="col-md-7">
                                            <?php 
$options = CommonFunction::roles();
?>
                                            {{Form::select('role', $options ,$info->role ,array('class'=>'form-control'))}}
                                            </div>

                                            
                    </div>
                    <div class="form-group">
                                              <?php 
$options = CommonFunction::getOptions('organization_all');
?>
                                            {{Form::label('organization','Organization', array('class' => 'col-xs-4 control-label'))}}
                                            <div class="col-xs-7">                                          
                                            <select id="organizationEx" name='organization' class="demo-default" placeholder="Select  Organization...">
                                                <option  selected='selected' value="{{$info->organization}}">{{$info->organization}}</option>
                                                @foreach($options as $organization)
                                                <option value="{{$organization}}">{{$organization}}</option>
                                                @endforeach
                                            </select>                                       
                                            </div>
                                            
                    </div>
                    <div class="form-group">
                                           
                                            {{Form::label('email','Email', array('class' => 'col-xs-4 control-label'))}}
Example #12
0
	<div class="row">
		<div class="col-xs-12 ">
			<div class="game-detail-l">
				<ul>
					<li><p class="game-detail-l-n"><?php 
echo $gameDateDetail;
?>
   <?php 
echo $site;
?>
</p></li>
					<li><p class="game-detail-l-w"><?php 
echo $leagueName;
?>
-<?php 
echo CommonFunction::code2GameFormat($nature);
?>
</p></li>
				</ul>
			</div>
		</div>
	</div>

	<div class="row">
		<div class="col-xs-12 ">
			<div class="game-detail-l">
				<!-- Nav tabs -->
				<ul class="nav nav-tabs" role="tablist">
					<li role="presentation" class="active"><a href="#shooter_range" role="tab" data-toggle="tab">射手榜</a></li>
					<li role="presentation"><a href="#assits_range" role="tab" data-toggle="tab">助攻榜</a></li>
					<li role="presentation"><a href="#assits_member" role="tab" data-toggle="tab">阵容</a></li>
 /**
  * @desc 修复android严重比赛结果后没保存TeamScore的问题
  */
 public function actionTestSaveTeamScore()
 {
     $masterId = CommonFunction::getUserId();
     $gameId = "b404c1fc88";
     $homeTeamScore = "8";
     $opponentTeamScore = "0";
     $leagueModel = new LeagueModel();
     $res = $leagueModel->findByMaster($masterId, 1);
     if (empty($res)) {
         throw new CHttpException(500, '该用户无权限管理联赛');
     }
     $leagueId = $res[0]->objectId;
     $gameModel = new TournamentModel();
     $userModel = new UserModel();
     $gameArr = $gameModel->findByObjectId($gameId);
     if (isset($gameArr[0])) {
         $game = $gameArr[0];
         if (isset($game->home_court->captain->objectId)) {
             $homeTeamCaptainId = $game->home_court->captain->objectId;
             $homeTeamCaptain = $userModel->getByObjectId($homeTeamCaptainId);
             if (!empty($homeTeamCaptain)) {
                 if (isset($homeTeamCaptain->username) && !empty($homeTeamCaptain->username)) {
                     $homeTeamCaptainUsername = $homeTeamCaptain->username;
                 }
             }
         }
         if (isset($game->opponent->captain->objectId)) {
             $opponentTeamCaptainId = $game->opponent->captain->objectId;
             $opponentTeamCaptain = $userModel->getByObjectId($opponentTeamCaptainId);
         }
     }
     //		var_dump($game);exit;
     $res = '';
     try {
         //			$res = $gameModel->updateScore($gameId,$homeTeamScore,$opponentTeamScore);
     } catch (Exception $e) {
         //echo $e;
     }
     if (true) {
         if (isset($gameArr[0])) {
             $game = $gameArr[0];
             $teamScoreModel = new TeamScoreModel();
             if (isset($game->home_court->objectId)) {
                 $homeTeamId = $game->home_court->objectId;
                 if (isset($game->home_court->name)) {
                     $homeTeamName = $game->home_court->name;
                 }
                 $diffScore = $homeTeamScore - $opponentTeamScore;
                 $win = false;
                 $draw = false;
                 $loss = false;
                 $score = 0;
                 if ($diffScore > 0) {
                     $win = true;
                     $score = 3;
                 } elseif ($diffScore == 0) {
                     $draw = true;
                     $score = 1;
                 } elseif ($diffScore < 0) {
                     $loss = true;
                 }
                 $homeTeamBasic = array('league' => array("__type" => "Pointer", "className" => "League", "objectId" => $leagueId), 'competition' => array("__type" => "Pointer", "className" => "Tournament", "objectId" => $gameId), 'team' => array("__type" => "Pointer", "className" => "Team", "objectId" => $homeTeamId), 'name' => $homeTeamName);
                 $homeTeamDev = array('goals' => $homeTeamScore, 'goals_against' => $opponentTeamScore, 'goal_difference' => $diffScore, 'win' => $win, 'draw' => $draw, 'loss' => $loss, 'score' => $score);
                 $hasData = $teamScoreModel->findByCompetitionTeam($gameId, $homeTeamId);
                 if (!isset($hasData[0]->objectId)) {
                     $homeTeamData = array_merge($homeTeamBasic, $homeTeamDev);
                     $teamScoreModel->save($homeTeamData);
                 } else {
                     $teamScoreId = $hasData[0]->objectId;
                     $teamScoreModel->update($teamScoreId, $homeTeamDev);
                 }
             }
             if (isset($game->opponent->objectId)) {
                 $opponentTeamId = $game->opponent->objectId;
                 if (isset($game->opponent->name)) {
                     $opponentTeamName = $game->opponent->name;
                 }
                 $diffScore = $opponentTeamScore - $homeTeamScore;
                 $win2 = false;
                 $draw2 = false;
                 $loss2 = false;
                 $score2 = 0;
                 if ($diffScore > 0) {
                     $win2 = true;
                     $score2 = 3;
                 } elseif ($diffScore == 0) {
                     $draw2 = true;
                     $score2 = 1;
                 } elseif ($diffScore < 0) {
                     $loss2 = true;
                 }
                 $opponentTeamBasic = array('league' => array("__type" => "Pointer", "className" => "League", "objectId" => $leagueId), 'competition' => array("__type" => "Pointer", "className" => "Tournament", "objectId" => $gameId), 'team' => array("__type" => "Pointer", "className" => "Team", "objectId" => $opponentTeamId), 'name' => $opponentTeamName);
                 $opponentTeamDev = array('goals' => $opponentTeamScore, 'goals_against' => $homeTeamScore, 'goal_difference' => $diffScore, 'win' => $win2, 'draw' => $draw2, 'loss' => $loss2, 'score' => $score2);
                 $hasData2 = $teamScoreModel->findByCompetitionTeam($gameId, $opponentTeamId);
                 if (!isset($hasData2[0]->objectId)) {
                     $opponentTeamData = array_merge($opponentTeamBasic, $opponentTeamDev);
                     $teamScoreModel->save($opponentTeamData);
                 } else {
                     $teamScoreId2 = $hasData2[0]->objectId;
                     $teamScoreModel->update($teamScoreId2, $opponentTeamDev);
                 }
             }
         }
         $response = 'success';
     } else {
         $response = 'fail';
     }
 }
Example #14
0
@extends('layout')
@section('content')
<section class="content contentWidth">

<div class="row">
    <div class="col-md-12">
        <div class="box box-solid box-primary">          
            <div class="box-body">
            <?php 
$phaseInfo = CommonFunction::phaseInfo($phaseId);
?>
               <span>{{$phaseInfo->title}}: {{$phaseInfo->subtitle}}</span> 
            </div>
        </div>
    </div>    
</div>

	<div class="row">
		<div class="col-md-4">
                <!-- small box -->
            <div class="small-box bg-aqua " >
                <div class="inner">
                    <h4 style='font-weight:bold;'>Timeline & Sample Template Management</h4>
                </div>
                
                <a class="small-box-footer" href="{{URL::to('certification/timeline/'.$phaseId);}}">
                    More info <i class="fa fa-arrow-circle-right"></i>
                </a>
            </div>
        </div><!-- ./col -->
		<div class="col-lg-3 col-xs-6 col-md-3 col-md-3">
                           {{CommonFunction::safetyTitle($info->sc_number)}} [ {{$info->sc_number}} ]
                        @endif
                        </td>
                        <td>
                           <?php 
$count = CommonFunction::isEdpLegalOpenionGiven($info->edp_number);
?>
                           @if($count>0)
                           Given
                           @else 
                           Not Given
                           @endif
                        </td>
                        <td>
                           <?php 
$count = CommonFunction::isEdpApproved($info->edp_number);
?>
                           @if($count>0)
                           Approved
                           @else 
                           Not Approved
                           @endif
                        </td>
                        <td class='hidden-print'><a href="{{URL::to('edp/singleEdp/'.$info->edp_number)}}">Details</a></td>
                     </tr>
                     @endforeach
                     @else 
                     <tr>
                        <td colspan="4">
                           No EDP Found Yet!!						
                        </td>
				{{Form::open(array('url'=>'surveillance/saveChecklistAnswer','method'=>'post','class'=>'form-horizontal','data-toggle'=>'validator','role'=>'form'))}}
				  {{Form::hidden('checklist_number','CL'.'_'.date('d').'_'.date('m').'_'.date('Y').'_'.time())}}
				<div class="form-group ">
                                        
											{{Form::label('checklist_number', 'Checklist Number', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::text('checklist_number_NA','CL'.'_'.date('d').'_'.date('m').'_'.date('Y').'_'.time(), array('class' => 'form-control','placeholder'=>'','required'=>'','disabled'=>''))}}
											</div>
											
                </div>
				<div class="form-group ">
                                        
											{{Form::label('sia_number ', 'SIA/ Tracking Number', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											<?php 
$options = CommonFunction::siaActionListedSiaNumber();
?>
											{{ Form::select('sia_number',$options,null, ['class' => 'demo-default','id'=>'checklist_sia_number','placeholder'=>'Select SIA/ Tracking Number']) }}
											</div>
											
                </div>
					
            @foreach($checklist as $info)
                    <div class="form-group ">
                                           
											{{Form::label('question', $info->question, array('class' => 'col-xs-4 col-md-4 control-label'))}}<br/>
											<div class="col-xs-6 col-md-6 ">
												<div class="radio">
											 	 <label> {{ Form::radio('answer', 'Yes',true) }} &nbsp  YES</label>
												 <label> {{ Form::radio('answer', 'No') }} &nbsp  NO</label>
												 <label> {{ Form::radio('answer', 'NA') }} &nbsp  NA</label>
Example #17
0
 /**
  * @desc 百度云推送
  * @param $users 用户的对象数组
  * @param $title	推送的标题
  * @param $msg	推送的内容
  * @param $type	详细看文档
  * @param $subType	详细看文档
  * @param $msg_type 推送的类型:0:消息(透传)1:通知
  * @param $options
  * @return bool|mixed
  */
 public function push($users, $title, $msg, $type, $subType, $optional, $msg_type = 1)
 {
     $pushMsgModel = new PushMsgModel();
     if (!is_array($users)) {
         $users = array($users);
     }
     if (count($users) > 0) {
         $masterId = CommonFunction::getUserId();
         $content = $msg;
         $saveBatchArr = array();
         //保存推送消息到PushMsg表
         foreach ($users as $user) {
             if (isset($user->username) && !empty($user->username)) {
                 $extra = array("belongId" => $user->username, "title" => $title, "type" => $type, "time" => time(), "targetId" => $this->getTargetId($subType, $optional), "subtype" => $subType);
                 $saveArr = array('belongUsername' => $user->username, 'isRead' => 0, 'status' => 0, 'msgType' => 0, 'extra' => json_encode($extra), 'content' => $content);
                 array_push($saveBatchArr, $saveArr);
             }
         }
         try {
             $results = $pushMsgModel->saveBatch($saveBatchArr);
         } catch (Exception $e) {
             return $e->getMessage();
         }
         //发送百度推送
         for ($i = 0; $i < count($users); $i++) {
             $user = $users[$i];
             $result = $results[$i];
             if (!property_exists($user, 'pushUserId')) {
                 continue;
             }
             if ($user->pushUserId == "") {
                 continue;
             }
             $push_type = 1;
             //推送单播消息
             $optional[Channel::USER_ID] = $user->pushUserId;
             //如果推送单播消息,需要指定user
             $message = array();
             if ($user->deviceType == "ios") {
                 //指定发到ios设备
                 $optional[Channel::DEVICE_TYPE] = 4;
                 //apns证书状态
                 $optional[Channel::DEPLOY_STATUS] = Yii::app()->params['apnDeployStatus'];
                 $message['aps']['alert'] = $msg;
                 $message['aps']['sound'] = "";
                 $message['aps']['badge'] = 0;
                 $message['objectId'] = $result->success->objectId;
                 $message['belongId'] = $user->username;
                 $message['targetId'] = $this->getTargetId($subType, $optional);
                 $message['title'] = $title;
                 $message['time'] = time();
                 $message['type'] = $type;
                 $message['subtype'] = $subType;
                 $message['flag'] = "notice";
             } else {
                 //android
                 $optional[Channel::DEVICE_TYPE] = 3;
                 $message['title'] = $title;
                 $message['description'] = $msg;
                 $message['custom_content']['objectId'] = $result->success->objectId;
                 $message['custom_content']['belongId'] = $user->username;
                 $message['custom_content']['targetId'] = $this->getTargetId($subType, $optional);
                 $message['custom_content']['title'] = $title;
                 $message['custom_content']['time'] = time();
                 $message['custom_content']['type'] = $type;
                 $message['custom_content']['subtype'] = $subType;
                 $message['custom_content']['flag'] = "notice";
             }
             $optional[Channel::MESSAGE_TYPE] = $msg_type;
             $message_key = md5(json_encode($message));
             $ret = $this->channel->pushMessage($push_type, json_encode($message), $message_key, $optional);
             //			    echo "send pushId:".$user->pushUserId."<br/>";
             //检查返回值
             if (false === $ret) {
                 echo 'baiduPush_WRONG, ' . __FUNCTION__ . ' ERROR!!!!<br/>';
                 echo 'baiduPush_ERROR NUMBER: ' . $this->channel->errno() . '<br/>';
                 echo 'baiduPush_ERROR MESSAGE: ' . $this->channel->errmsg() . '<br/>';
                 echo 'baiduPush_REQUEST ID: ' . $this->channel->getRequestId() . '<br/>';
                 echo '<br/>';
             }
         }
     }
     //		Helper::flash('error', "你无权限编辑联赛信息(请确认你至少有一个联赛的管理权限)!", '/site/');
 }
                    		@endif

						    </td>						    
										<!--Level -3-->
										
						    <td class="text-center" >



                    		  

						<!--This employee's - this formal course, this ojt level3 status  -->

						<?php 
$ojtL3 = CommonFunction::ojtCourseStatus($data->its_course_number, $info->its_job_task_no, $emp_tracker, 'L3');
?>

                    		<?php 
$validityLevel3 = 0;
?>

                    		@if(!$ojtL3)

                    			@if($ojtL2 )

	                    		Not Done

	                    		

	                    		@else 
Example #19
0
                                                </td>
                                                <td>
                                                    <?php 
$edpNum = CommonFunction::edpCount($info->sia_number);
?>
                                                    @if($edpNum!=0)
                                                    EDP-{{$edpNum}}
                                                    @else
                                                        No EDP Listed Yet
                                                    @endif

                                                </td>
                                                <td>
                                                    <?php 
$status = CommonFunction::programStatus($info->sia_number);
?>
                                                    @if($status!=0)
                                                        <span style="color:green">Close</span>
                                                    @else 
                                                        <span style="color:red">Open</span>
                                                    @endif
                                                </td>
                                                <td><a  href="{{URL::to('surveillance/singleProgram/'.$info->sia_number)}}">Details</a></td>
                                            </tr>
                                            @endif

                                        @endforeach
                                        <tbody>
                                        
                                        </tbody>
Example #20
0
 		<table id="example1" class="table table-bordered table-striped table-responsive">
                                        <thead>
                                            <tr>
                                                <th>#</th>
                                               
                                                <th>Name</th>
                                                <th>Task Title</th>
                                                <th>Active</th>                 
                                                <th>Details</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                         <div style="display: none">{{$num=0;}}</div>
                                          @foreach($emps as $info)
                                          <?php 
$name = CommonFunction::empNameByEmpId($info->emp_id);
?>
                                          @if($name)
                                            <tr>
                                                <td>{{++$num}}</td>
                                               
                                                <td>
                                                  {{$name}}
                                                </td>
                                                <td>{{$info->name}}</td>
                                                <td>{{$info->active}}</td>
                                                <td><a href="{{URL::to('qualification/comp_view/'.$info->emp_id.'#'.'task_'.$info->id)}}">View</a></td>
                                            </tr>
                                          @endif
                                            
                                          @endforeach
        $siaNumber = '';
    }
    //getting member in an array
    $members = CommonFunction::updateMultiSelection('sia_program', 'sia_number', $siaNumber, 'team_members');
    //checking whether member or not
    $imTeamMember = CommonFunction::isItMe($members, Auth::user()->emp_id());
}
?>
                                         @if($imTeamMember=='true')   
	                                        	<tr>
	                                        		<td>
	                                        			{{++$num}}
	                                        		</td>
	                                        		<td><a href="{{URL::to('surveillance/singleProgram/'.$data->sia_number)}}">{{$data->sia_number}}</a></td>
	                                        		<td>	<?php 
$members = CommonFunction::updateMultiSelection('sia_program', 'sia_number', $data->sia_number, 'team_members');
?>
                                               @if($members)
                                               @if($members!=null)
                                                    @foreach($members as $key=>$value)
                                                        {{$value}},
                                                    @endforeach
                                               
                                                @endif
                                                @else
                                                    No Members Added!!
                                                @endif</td>
	                                        		<td>{{CommonFunction::orgNameUsingSiaNumber($data->sia_number)}}</td>
	                                        		<td>{{CommonFunction::findingTitle($data->finding_number)}}[{{$data->finding_number}}]</td>
	                                        		<td>{{CommonFunction::safetyTitle($data->safety_issue_number)}} [{{$data->safety_issue_number}}]</td>
 /**
  * @desc 调用云端代码更新联赛射手榜数据
  */
 public function actionUpdateShooterData()
 {
     $leagueId = Yii::app()->request->getPost('leagueid');
     $cloudCodeModel = new BmobCloudCode('userGoalAssist');
     $res = $cloudCodeModel->get(array('leagueId' => "{$leagueId}"));
     if (empty($res)) {
         CommonFunction::ajaxResult(State::$SHOOTER_RANGE_ERROR_CODE, State::$SHOOTER_RANGE_ERROR_MSG);
     } else {
         //更新射手榜发送推送
         $baiduPushModel = new BaiduPushModel();
         $baiduPushModel->sendMessageForAllLeague(4, 21, $leagueId, "更新了射手榜");
         CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('response' => $res));
     }
 }
Example #23
0
					<div class="form-group required">
                                           
											{{Form::label('serial_number', 'Serial Number', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::text('serial_number','', array('class' => 'form-control','placeholder'=>'i.e Boeing-737NG-123456','required'=>''))}}
											</div>
											
                    </div>
					
					<div class="form-group required">
                                           
											{{Form::label('state_registration', 'State Of Registration', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											<select id="state_registration" name='state_registration' class="demo-default" placeholder="Select  State Of Registration...">
												<?php 
$options = CommonFunction::stateOfReg();
?>
												<option value="">Select  State Of Registration...</option>
												@foreach($options as $option)
												<option value="{{$option}}">{{$option}}</option>
												@endforeach
											</select>
											</div>
											
                    </div>
					<div class="form-group required">
                                           
											{{Form::label('registration_no', 'Registration No#', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::text('registration_no','', array('class' => 'form-control','placeholder'=>'','required'=>''))}}
											</div>
Example #24
0
                                            </tr>
                                        </thead>
                                        <tbody>
                                         <div style="display: none">{{$num=0;}}</div>
                                        @foreach ($infos as $info)
                                            <tr>
                                                <td>{{$info->sia_number}}</td>
                                                <td>{{CommonFunction::siaOrg($info->sia_number)}}</td>
												<td>{{CommonFunction::findingTitle($info->finding_number)}} [{{$info->finding_number}}]</td>
												<td>{{CommonFunction::safetyTitle($info->safety_issue_number)}} {{$info->safety_issue_number}}</td>
												<td>{{date('d F Y',strtotime($info->issue_finding_date))}}</td>
												
												<td>{{date('d F Y',strtotime($info->target_date))}}</td>
												
												<td><?php 
$count = CommonFunction::isSafetyConsApproved($info->safety_issue_number);
?>
							@if($count>0)
								Yes
							@else 
								No
							@endif</td>
                                                <td><a target="_blink" href="{{URL::to('safety/singlesafetyConcern/'.$info->safety_issue_number)}}">Details</a></td>
                                                
                                            </tr>
                                        @endforeach
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                               	<th>SIA Number</th>
												<th>Finding Number</th>
Example #25
0
									</div>
									<div class="col-md-1"></div>
									<div class="col-md-9">
										<table class="team-vs">
											<tr><td><div class="text-f2x team-vs-name"><span class="home-team"><?php 
        echo $homeCourtName;
        ?>
</span><i class="vs-icon"></i><span class="guest-team"><?php 
        echo $opponentName;
        ?>
</span></div></td></tr>
											<tr><td class="game-detail"><i class="fa fa-map-marker"></i><span class="game-location"><?php 
        echo $game->site;
        ?>
</span><p class="bg-primary"><?php 
        echo CommonFunction::code2GameFormat($game->nature . "");
        ?>
</p></td></tr>
										</table>
									</div>
								</div>
							<?php 
    }
    ?>
						</div>
					</div>
				<?php 
}
?>
			</div>
		</div>
                       		</tr>
                       	</thead>
                        <tbody>
                        @foreach($assoOjts as $info)
                       		<tr>
                       			<td>{{$info->job_task_no}}</td>
                       			<td><?php 
$title = CommonFunction::getOjtTitle($info->job_task_no);
?>
{{$title}}</td>
                       			<td>
								<?php 
$ojtL3 = CommonFunction::ojtCourseStatus($info->itscn, $info->job_task_no, $emp_tracker, 'L3');
?>
                    			<?php 
$formalStatus = CommonFunction::formalCourseStatus($info->itscn, $emp_tracker);
?>
								@if($formalStatus&&$ojtL3)
									<span style="color: green">Inspector</span>
								@else 
									<span style="color: red">Trainee</span>
								@endif

                       			</td>
                       			<td>{{ HTML::linkAction('itsOjtController@trineeSingleOjtCourse', 'View',array($info->itscn,$info->job_task_no,$emp_tracker), array('class' => '')) }}</td>
                       		</tr>
                       	@endforeach
                        
                        </tbody>
                    </table>
					
Example #27
0
                    </div> 
					
                    <div class="form-group required">
                                           
											{{Form::label('subtitle', 'Subtitle', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
											{{Form::text('subtitle',' ', array('class' => 'form-control','placeholder'=>'','required'=>''))}}
											</div>
											
                    </div>      
                    <div class="form-group required">
                                        
											{{Form::label('category_id', 'Category', array('class' => 'col-xs-4 control-label'))}}
											<div class="col-xs-6">
                                            <?php 
$options = CommonFunction::getOptions('certificate_category');
?>
											
                                            {{Form::select('category_id',[''=>'Select Category...']+$options,'',array('class'=>'form-control','required'=>''))}}

											
											</div>
											
                    </div>
                     <div class="form-group required">
                                           
                                            {{Form::label('total_day', 'Total Day(s)', array('class' => 'col-xs-4 control-label'))}}
                                            <div class="col-xs-6">
                                            {{Form::text('total_day',' ', array('class' => 'form-control','placeholder'=>'','required'=>''))}}
                                            </div>
                                            
Example #28
0
												<th>Title</th>
												<th>Approval Date</th>
												<th>Inspector Type</th>
												<th>Training Category</th>
												<th>Associative CAA Job Task #</th>							
												<th>View Details</th>
											</tr>
										</thead>
										
										<tbody>
										@if($ojtCourses)
										@foreach ($ojtCourses as $info) 
										<tr>
												<td>
												<?php 
$name = CommonFunction::getFormalCourseTitle($info->its_course_number);
?>
													{{ HTML::linkAction('itsOjtController@singleFormalCourse',$info->its_course_number.' : ' . $name,array($info->its_course_number), array('class' => '','title'=>$name,'target'=>'_blink','style'=>'color:#FFF!important')) }}
													
												</td>
												<td>{{$info->its_job_task_no}}</td>
												<td>{{$info->title}}</td>
												<td>{{$info->approval_date}}</td>
												<td>{{$info->inspector_type}}</td>
												<td>{{$info->training_category}}</td>
												<td>{{$info->associative_faa_job_task_no}}</td>
												
																					
												<th>{{ HTML::linkAction('itsOjtController@singleOjtCourse',"Details",array($info->its_job_task_no), array('class' => '','title'=>$info->title)) }}</th>
										</tr>
										@endforeach
	                                        <?php 
$num = 0;
?>
                                    	    @foreach ($notApproveEdp as $info)  
                                    	    <?php 
$data = CommonFunction::getEdpNumberInfo($info);
?>
		
                                    	    <?php 
if ($fullAccess == 'true') {
    $imTeamMember = 'true';
} else {
    //getting member in an array
    $members = CommonFunction::updateMultiSelection('sia_program', 'sia_number', $data->sia_number, 'team_members');
    //checking whether member or not
    $imTeamMember = CommonFunction::isItMe($members, Auth::user()->emp_id());
}
?>
                                         @if($imTeamMember=='true')
                          
	                                        	<tr>
	                                        		<td>{{++$num}}</td>
	                                        		<td>
	                                        		 <a href="{{URL::to('surveillance/singleProgram/'.$data->sia_number)}}">{{$data->sia_number}}</a>
	                                        		
	                                        		</td>
	                                        		<td>
	                                        			{{$org=CommonFunction::orgNameUsingSiaNumber($data->sia_number)}}
	                                        		</td>
	                                        		
	                                        		<td>{{$findingTitle=CommonFunction::findingTitle($data->finding_number)}} [{{$data->finding_number}}]</td>
Example #30
0
 public function saveUser()
 {
     $rules_user_registration = array('name' => 'required|min:2', 'emp_id' => 'required|min:2|unique:users', 'email' => 'required|email|unique:users', 'designation' => 'required', 'password' => 'required|alpha_num|between:5,30|confirmed', 'password_confirmation' => 'required|alpha_num|between:5,30');
     $validator = Validator::make(Input::all(), $rules_user_registration);
     if ($validator->passes()) {
         //return Input::get('password');
         $user = new User();
         $user->name = Input::get('name');
         $user->emp_id = Input::get('emp_id');
         $user->email = Input::get('email');
         $user->role = Input::get('designation');
         $user->organization = Input::get('organization');
         $user->password = Hash::make(Input::get('password'));
         $user->save();
         $name = Input::get('name');
         $emp_id = Input::get('emp_id');
         $role = Input::get('designation');
         //User Initialization
         //pull all privilege area of role form role_privilege_details
         $designation = Input::get('designation');
         $privileges = DB::table('role_privilege_details')->where('role_id', trim($designation))->get();
         //('role_privillege_area');
         foreach ($privileges as $area) {
             DB::table('module_user_permission')->insert(array('user_id' => $emp_id, 'module_name' => $area->role_privilege_area, 'access' => $area->access, 'entry' => $area->entry, 'update' => $area->update, 'approve' => $area->approve, 'worning' => $area->worning, 'sof_delete' => $area->sof_delete, 'par_delete' => $area->par_delete, 'report' => $area->report));
         }
         //end of privilage
         return Redirect::to('settings')->with('message', "Emp Id <a href=singleUser/" . $emp_id . ">" . $emp_id . "( " . $name . " )</a> holder is Now Getting Privilege of " . CommonFunction::roleName($role));
     } else {
         return Redirect::to('settings')->with('error', 'The following errors occurred')->withErrors($validator)->withInput();
     }
 }