示例#1
0
function getPrevSemesterDates()
{
    $startWinter = "01-01";
    $endWinter = "04-30";
    $startSummer = "05-01";
    $endSummer = "08-31";
    $startFall = "09-01";
    $endFall = "12-31";
    $today = getToday();
    $todayDate = date_format($today, "m-d");
    $year = date_format($today, "Y");
    if ($todayDate >= $startWinter && $todayDate <= $endWinter) {
        //we're in Winter semester, update last Fall
        $startDate = $year - 1 . "-" . $startFall;
        $endDate = $year - 1 . "-" . $endFall;
    } else {
        if ($todayDate >= $startSummer && $todayDate <= $endSummer) {
            //we're in Summer semester, update Winter
            $startDate = $year . "-" . $startWinter;
            $endDate = $year . "-" . $endWinter;
        } else {
            //we're in Fall semester, update Summer
            $startDate = $year . "-" . $startWinter;
            $endDate = $year . "-" . $endWinter;
        }
    }
    return array("start" => $startDate, "end" => $endDate);
}
示例#2
0
 function getMyCustomerEx()
 {
     header('Access-Control-Allow-Origin:*');
     //跨域
     header("Content-type: text/html; charset=utf-8");
     $param = json_decode(file_get_contents('php://input'), true);
     $token = $param['xtoken'];
     init_verify_token($token);
     $coachid = $param['coachid'];
     // $coachid = 53;
     if (empty($coachid)) {
         err_ret(-205, 'lack of param', '缺少参数');
     }
     //最新付款的
     $sql = "SELECT user_info.id,user_info.username,user_info.username,user_info.name,user_info.header,user_info.birthday,user_info.gender,user_info.height,user_info.weight,my_plan.course_time,my_plan.pid,my_plan.pay_time,my_plan.begin_time,my_plan.end_time,my_plan.status,my_plan.iscontacted,my_plan.isfinished\n                FROM user_info,my_plan  \n                WHERE my_plan.coachid={$coachid} AND my_plan.uid=user_info.id AND user_info.type=2";
     $model = new Model();
     $result = $model->query($sql);
     $new_pay_list = array();
     //最新付款
     $complete_test = array();
     //完成测试
     $usual_remind = array();
     //日常督促
     // $update_plan    = array();     //更新计划
     for ($i = 0; $i < count($result); $i++) {
         //最新付款的
         if (isSameDay($result[$i]['pay_time'], time())) {
             //如果是今天付款的
             $new_pay_list[] = $result[$i];
         }
         //完成测试
         if ($result[$i]['status'] == 2) {
             $complete_test[] = $result[$i];
         }
         //日常督促(昨天,今天,明天有计划的)
         if (timeToStr($result[$i]['course_time']) == getYesterday() || timeToStr($result[$i]['course_time']) == getToday() || timeToStr($result[$i]['course_time']) == getTomorrow()) {
             $usual_remind[] = $result[$i];
         }
         //更新训练课程的
         // if( (getTomorrow() == timeToStr($result[$i]['course_time'])
         //    || getAfterTomorrow() == timeToStr($result[$i]['course_time']))
         //    && (timediffDay($result[$i]['course_time'],$result[$i]['end_time']) == 1
         //     ||( timediffDay($result[$i]['course_time'],$result[$i]['end_time']) == 2))){
         //     $update_plan[] = $result[$i];
         // }
     }
     $data['errno'] = 0;
     $data['new_pay_list'] = $new_pay_list;
     $data['complete_test'] = $complete_test;
     $data['usual_remind'] = $usual_remind;
     $data['update_plan'] = [];
     echo json_encode($data);
 }
示例#3
0
文件: add.php 项目: aile54/akachan
						<th class="full" colspan="3">NỘI DUNG</th>
					</tr>
					<tr>
						<td class="first" width="96"><strong>Id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
						<td width="536" colspan="2" class="last">#<?php 
echo $tbl->getLastId() + 1;
?>
</td>
					</tr>
					<tr>
						<td class="first"><strong>Name</strong></td>
						<td colspan="2" class="last"><input name="name" type="text" class="text" id="name" value="backupfile" /></td>
					</tr>
					<tr class="bg">
						<td class="first"><strong>Date</strong></td>
						<td colspan="2" class="last"><input type="text" class="text" value="<?php 
echo getToday();
?>
" name="date" /><img style="cursor:pointer;" src="js/calendar/images/calendar.gif" onClick="displayCalendar(document.forms[0].date,'yyyy-mm-dd',this)" ></td>
					</tr>
					<tr class="bg">
					  <td class="first">&nbsp;</td>
					  <td colspan="2" class="last"><label>
					    <input type="submit" name="done" value="Submit" id="done" />
					  </label></td>
				  </tr>
				</table>
				</form>
	        <p>&nbsp;</p>
		  </div>
		</div>
示例#4
0
 function saveSeasonData()
 {
     $sql = "\n\t\t\tINSERT INTO tb_data(dt_stamp,id_player,id_season, seasonYear, seasonNumber,\n\t\t\t\tgamesThisSeason,winsThisSeason,lossThisSeason,\n\t\t\t\tterranWins,protossWins,zergWins,ratio)\n\t\t\tVALUES('" . getToday() . "',{$this->idPlayer},{$this->seasonId}, {$this->seasonYear}, {$this->seasonNumber},\n\t\t\t\t{$this->gamesThisSeason},{$this->winsThisSeason},{$this->lossThisSeason},\n\t\t\t\t{$this->terranWins},{$this->protossWins},{$this->zergWins},{$this->ratio});\n\t\t\t";
     //echo $sql;
     if (!queryDB($sql)) {
         loga($this->name . ": ERROR! Cant save Season data.");
     } else {
         loga($this->name . ": Season data Ok.");
     }
 }
示例#5
0
function cleanDay()
{
    $sql = "delete from tb_data where dt_stamp = '" . getToday() . "'";
    queryDB($sql);
}
示例#6
0
function getSaisonFaktor()
{
    if (getToday() >= "07-01" and getToday() <= "08-31") {
        return 1.1;
    } elseif (getToday() > "09-01" and getToday() < "11-31") {
        return 0.95;
    } else {
        return 1;
    }
}
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $this->command->info('Seeding: CreateProfilesProjectsSeeder Class...');
     //converting string to date;
     function setDate()
     {
         $min_date = '2014-09-01 00:00:00';
         $max_date = '2014-10-31 00:00:00';
         $min_epoch = strtotime($min_date);
         $max_epoch = strtotime($max_date);
         $rand_epoch = rand($min_epoch, $max_epoch);
         return date('Y-m-d H:i:s', $rand_epoch);
     }
     function getToday($date)
     {
         return $date->format('YmdHis');
     }
     // create a dummy image for project
     function getProjectsThumbnail()
     {
         $thumbnail = ['image-1.jpg', 'image-2.jpg', 'image-3.jpg', 'image-5.jpg', 'image-6.jpg', 'image-7.jpg', 'image-8.jpg', 'image-9.jpg'];
         return $thumbnail[array_rand($thumbnail)];
     }
     //set variable for faker class
     $faker = Faker\Factory::create();
     // clean the data first
     DB::table('projects')->delete();
     DB::table('user_profiles')->delete();
     // delete all images folder
     $directory = public_path() . '/uploads/projects';
     File::deleteDirectory($directory, true);
     // set required limit for users
     $user_limit = 5;
     // loop for require number of users
     for ($i = 0; $i < $user_limit; $i++) {
         $first_name = $faker->firstName($gender = null | 'male' | 'female');
         $last_name = $faker->lastName;
         $username = strtolower($first_name) . '.' . strtolower($last_name);
         $email = $username . '@gmail.com';
         // create sentry user
         Sentry::getUserProvider()->create(array('email' => $email, 'username' => $username, 'password' => 'sentrytest', 'activated' => 1));
         // set default user property rights
         $userUser = Sentry::getUserProvider()->findByLogin($email);
         $userGroup = Sentry::getGroupProvider()->findByName('Users');
         $userUser->addGroup($userGroup);
         // get the user id for foreign key
         $user_id = $userUser['attributes']['id'];
         // prepare data for profiles table
         $user_profiles = ['user_id' => $user_id, 'first_name' => $first_name, 'last_name' => $last_name, 'contact_number' => $faker->numerify($string = '############'), 'company' => $faker->company . ' ' . $faker->companySuffix, 'created_at' => new DateTime(), 'updated_at' => new DateTime()];
         // insert the data in user profiles
         DB::table('user_profiles')->insert($user_profiles);
         // dummy thumbnail setup
         /*-------------------------------------------------------*/
         $projects = public_path() . '/uploads/projects';
         $dummyDir = public_path() . '/assets/images/dummy/projects';
         // set random limit of projects per user_id
         $random_limit = rand(7, 9);
         $this->command->info('->current number of user (' . $i . '/ ' . $user_limit . ' )');
         // set the random limit of projects per user
         for ($a = 0; $a < $random_limit; $a++) {
             $this->command->info('-->random number of projects per user id (' . $a . '/ ' . $random_limit . ' )');
             // create folder based on username
             $usernameDir = $projects;
             File::makeDirectory($usernameDir, 0777, true, true);
             /*-------------------------------------------------------*/
             $date = getToday(new DateTime());
             $thumbnail = getProjectsThumbnail();
             $link = URL::asset('uploads/projects') . '/' . $date . '/' . $thumbnail;
             // prepare data for projects table
             $project = ['title' => $faker->text($maxNbChars = 25), 'short_description' => $faker->text($maxNbChars = 200), 'thumbnail' => $link, 'target_fund' => $faker->numberBetween($min = 500, $max = 3000), 'thumbnail' => $link, 'target_date' => setDate(), 'activated' => rand(0, 1), 'user_id' => $user_id, 'created_at' => new DateTime(), 'updated_at' => new DateTime()];
             // insert the data in user profiles
             DB::table('projects')->insert($project);
             // create directory folder uploads/username/date
             $newDirectory = $usernameDir . '/' . $date;
             File::makeDirectory($newDirectory, 0777, true, true);
             // create a dummy thumbnail for the project
             $oldFile = $dummyDir . '/' . $thumbnail;
             $newFile = $newDirectory . '/' . $thumbnail;
             File::copy($oldFile, $newFile);
         }
     }
 }