$data['hrm_birthdate'] = $_POST['hrm_birthdate'];
 $member = NULL;
 if ($mode == 'update') {
     $member = new Member($_POST['id']);
     if (!$member->update($data)) {
         echo 'ko';
         exit;
     }
 } else {
     $member = new Member($_POST['email_addr']);
     $new_password = generate_random_string_of(6);
     $hash = md5($new_password);
     $data['password'] = $hash;
     $data['forget_password_question'] = '1';
     $data['forget_password_answer'] = 'system picked';
     $data['added_by'] = $employee->getId();
     $data['joined_on'] = $today;
     $data['active'] = 'Y';
     $data['invites_available'] = '10';
     if ($member->create($data) === false) {
         echo 'ko';
         exit;
     }
     $lines = file(dirname(__FILE__) . '/../private/mail/member_welcome.txt');
     $message = '';
     foreach ($lines as $line) {
         $message .= $line;
     }
     $message = str_replace('%member%', $_POST['firstname'] . ', ' . $_POST['lastname'], $message);
     $message = str_replace('%temporary_password%', $new_password, $message);
     $message = str_replace('%protocol%', $GLOBALS['protocol'], $message);
Beispiel #2
0
 /**
  * Declares an association between this object and a Employee object.
  *
  * @param      Employee $v
  * @return     User The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setEmployee(Employee $v = null)
 {
     if ($v === null) {
         $this->setEmployeeId(NULL);
     } else {
         $this->setEmployeeId($v->getId());
     }
     $this->aEmployee = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Employee object, it will not be re-added.
     if ($v !== null) {
         $v->addUser($this);
     }
     return $this;
 }
Beispiel #3
0
<?php

require 'connect.php';
require 'client/Book.php';
require 'client/Employee.php';
require 'client/Client.php';
require 'client/Hire.php';
$book = new Book(1, 'Metro', 'Gluhowsky', 'apokalipsa');
$employee = new Employee(2, 'Jan', 'Kowalski', '*****@*****.**', 'Warszawa');
$client = new Client(3, 'Anna', 'Kowalska', '*****@*****.**');
$hire = new Hire(4, $book, $employee, '2015-12-15', '2015-12-26');
$query = "INSERT INTO `book` (`id`, `title`, `author`, `type`) VALUES ('1', '{$book->getTitle()}', '{$book->getAuthor()}', '{$book->getType()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `employee` (`id`, `firstname`, `lastname`, `email`, `city`) VALUES ('2', '{$employee->getfirstName()}', '{$employee->getlastName()}', '{$employee->getEmail()}', '{$employee->getCity()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `client` (`id`, `firstname`, `lastname`, `email`) VALUES ('3', '{$client->getfirstName()}', '{$client->getlastName()}', '{$client->getEmail()}')";
$libraryRequest = mysql_query($query);
$query = "INSERT INTO `hire` (`id`, `id_client`, `id_book`, `id_employee`, `hiredate`, `returndate`) VALUES ('4', '{$client->getId()}', '{$book->getId()}', '{$employee->getId()}', '{$hire->getHireDate()}', '{$hire->getReturnDate()}')";
var_dump($query);
$libraryRequest = mysql_query($query);
Beispiel #4
0
<?php

require_once "../private/lib/utilities.php";
$data = Seed::generateSeed();
$sid = $data['login']['id'];
$seed = $data['login']['seed'];
$uid = '200801021';
$password = '******';
$employee = new Employee($uid, $sid);
$id = $employee->getId();
$hash = sha1($id . md5($password) . $seed);
echo $sid . " : " . $seed . "<br>";
echo $hash . "<br>";
?>
<p style="font-weight: bold;">Logging in... </p><p><?php 
if ($employee->isRegistered($hash)) {
    if ($employee->setSessionWith($hash)) {
        echo "Success";
    }
}
if (!$employee->isLoggedIn($hash)) {
    echo "failed";
    exit;
}
?>
</p><p style="font-weight: bold;">Update my details... </p><p><?php 
$old_data = $employee->get();
echo "Before...<br><br>";
echo "<pre>";
print_r($old_data);
echo "</pre><br><br>";
Beispiel #5
0
         $data['website_url'] = 'http://' . $_POST['website_url'];
     }
 }
 $employer = NULL;
 if ($mode == 'update') {
     $employer = new Employer($_POST['id']);
     if (!$employer->update($data)) {
         echo 'ko';
         exit;
     }
 } else {
     $employer = new Employer($_POST['user_id']);
     $new_password = generate_random_string_of(6);
     $hash = md5($new_password);
     $data['password'] = $hash;
     $data['registered_by'] = $employee->getId();
     $data['registered_through'] = 'M';
     $data['joined_on'] = $today;
     // $data['free_postings_left'] = $_POST['free_postings'];
     // $subscription_expire_on = $data['joined_on'];
     // if ($_POST['subscription_period'] > 0) {
     //     $subscription_expire_on = sql_date_add($data['joined_on'], $_POST['subscription_period'], 'month');
     // }
     if ($employer->create($data) === false) {
         echo 'ko';
         exit;
     }
     $lines = file(dirname(__FILE__) . '/../private/mail/employer_welcome.txt');
     $message = '';
     foreach ($lines as $line) {
         $message .= $line;
Beispiel #6
0
 $branch = $employee->getBranch();
 $yel_email = 'team.' . strtolower($branch[0]['country']) . '@yellowelevator.com';
 // 1. convert from CSV to array
 $candidates = array();
 $joined_on = now();
 if (move_uploaded_file($_FILES['members_csv_file']['tmp_name'], "/tmp/" . basename($_FILES['members_csv_file']['tmp_name']))) {
     $handle = fopen("/tmp/" . basename($_FILES['members_csv_file']['tmp_name']), 'r');
     if ($handle !== false) {
         while (($row = fgetcsv($handle)) !== false) {
             if (count($row) < 11) {
                 continue;
             }
             $candidate = array();
             $candidate['joined_on'] = $joined_on;
             $candidate['updated_on'] = $joined_on;
             $candidate['added_by'] = $employee->getId();
             $candidate['email_addr'] = $row[0];
             $candidate['firstname'] = $row[1];
             $candidate['lastname'] = $row[2];
             $candidate['phone_num'] = $row[3];
             $candidate['citizenship'] = strtoupper($row[4]);
             $candidate['total_work_years'] = sql_nullify($row[5]);
             $candidate['position_title'] = sql_nullify($row[6]);
             $candidate['work_from'] = sql_nullify($row[7]);
             $candidate['work_to'] = sql_nullify($row[8]);
             $candidate['employer'] = sql_nullify($row[9]);
             $candidate['employer_specialization'] = sql_nullify($row[10]);
             $candidates[] = $candidate;
         }
     }
     fclose($handle);
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Employee $value A Employee object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Employee $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }