Exemple #1
0
 /**
  * Алгоритм роботи звіту
  * 1. Вибрати всіх розробників з полями [Ім*я, Дата прийняття на роботу, Поточний ранг, Птозна ставка зп]
  * 2. Порахувати який повинен бути ранг по стажу і яка повинна бути ЗП
  * 3. Пропрахувати зміни, які будуть до кінця року.
  */
 public function getHRReport()
 {
     $users = $this->find('all', ['contain' => ['Specializations']])->toArray();
     $today = time();
     $tmp = [['Name, Age, Specializations, Experience,']];
     foreach ($users as $user) {
         $str = $user['first_name'] . ' ' . $user['last_name'] . ',' . (!empty($user['birthday']) ? round(($today - strtotime($user['birthday'])) / YEAR, 1) : '-') . ',' . (!empty($user['specializations'][0]) ? $user['specializations'][0]['name'] : ' spec ') . ',' . (!empty($user['work_start_date']) ? round(($today - strtotime($user['work_start_date'])) / YEAR, 1) : '-');
         wln($str);
         //            wln($user['first_name'].' '.$user['last_name'].','. (!empty($user['birthday'])?round(($today - strtotime($user['birthday']))/YEAR,0):'-' .',' ));
     }
     we($tmp);
 }
Exemple #2
0
<?php

/**
 * Created by PhpStorm.
 * User: xain
 * Date: 28.02.2016
 * Time: 23:25
 *
 * The Script check the photos for last week and upload missed
 */
require "lib.php";
$weekAgo = time() - ONE_DAY * 7;
print_r(">>>file: check-maps2.php >>> \r\n <br>");
for ($i = 0; $i < 7; $i++) {
    $timestamp = $weekAgo + ONE_DAY * $i;
    $bigMapFile = getFilenameOnDiskBig($timestamp);
    $smlMapFile = getFilenameOnDiskSml($timestamp);
    if (!file_exists(PATH_SAVE . $bigMapFile)) {
        $sourceMapFile = getLinkToSourceFile($timestamp);
        copy($sourceMapFile, PATH_SAVE . $bigMapFile);
        resize(SML_IMG_WIDTH, PATH_SAVE . $smlMapFile, PATH_SAVE . $bigMapFile);
        wln('Save img: ' . $bigMapFile);
    } else {
        wln('File exist: ' . $bigMapFile);
    }
}
Exemple #3
0
function we($var = 'ok')
{
    wln($var);
    exit;
}
Exemple #4
0
 /**
  * Get skills ID by name
  * @param $skill_name - the name fro
  * @return bool
  */
 private function getSkillID($skl)
 {
     $skill_name = $skl['skill'];
     $skill = $this->Skills->find('all', ['fields' => ['id'], 'conditions' => ['name' => $skill_name], 'contain' => []])->first();
     if (!empty($skill)) {
         return $skill['id'];
     } else {
         $groups = $this->SkillsGroups->find('all', ['fields' => ['id'], 'conditions' => ['name' => $skl['skills_group']], 'contain' => []])->first();
         $skill = $this->Skills->newEntity();
         $skill = $this->Skills->patchEntity($skill, ['name' => $skl['skill'], 'skills_groups_id' => $groups['id'], 'link' => $skl['skill_link']]);
         if ($this->Skills->save($skill)) {
             return $skill['id'];
         } else {
             wln('Error in save Skill');
             we($skill);
         }
     }
 }