Exemple #1
0
 function testCreatePair()
 {
     $staff_1 = new Staff();
     $staff_1->set(array('first_name' => 'First', 'last_name' => 'User'));
     $staff_1->save();
     $staff_2 = new Staff();
     $staff_2->set(array('first_name' => 'Second', 'last_name' => 'User'));
     $staff_2->save();
     $h = new Hour();
     $h->set(array('hours' => 6, 'staff_id' => $staff_1->id, 'pair_id' => $staff_2->id));
     $h->updateOrCreateWithPair();
     $this->assertTrue($h->id, 'should have an id');
     $this->assertTrue($h->get('pair_hour_id'), 'should have a pair hour id');
     $h2 = $h->getPairHour();
     $this->assertIsA($h2, 'Hour');
     $this->assertTrue($h2->id, 'should have an hour id');
     $this->assertEqual($h2->get('hours'), 6);
     $h->set(array('hours' => 7));
     $h->updateOrCreateWithPair();
     $h3 = $h->getPairHour();
     $this->assertEqual($h2->id, $h3->id);
     $this->assertEqual($h3->get('hours'), 7);
     $this->assertEqual($h3->getPairName(), $staff_1->getName());
     $this->assertEqual($h->getPairName(), $staff_2->getName());
 }
Exemple #2
0
 function assignStaff($staffId, $message, $alertstaff = true)
 {
     global $thisuser, $cfg;
     $staff = new Staff($staffId);
     if (!$staff || !$staff->isAvailable() || !$thisuser) {
         return false;
     }
     if ($this->setStaffId($staff->getId())) {
         //Reopen the ticket if cloed.
         if ($this->isClosed()) {
             //Assigned ticket Must be open.
             $this->reopen();
         }
         $this->reload();
         //
         //Send Notice + Message to assignee. (if directed)
         if ($alertstaff && ($thisuser && $staff->getId() != $thisuser->getId())) {
             //No alerts for self assigned.
             //Send Notice + Message to assignee.
             $dept = $this->getDept();
             if (!$dept || !($tplId = $dept->getTemplateId())) {
                 $tplId = $cfg->getDefaultTemplateId();
             }
             $sql = 'SELECT assigned_alert_subj,assigned_alert_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($tplId);
             if (($resp = db_query($sql)) && db_num_rows($resp) && (list($subj, $body) = db_fetch_row($resp))) {
                 $body = $this->replaceTemplateVars($body);
                 $subj = $this->replaceTemplateVars($subj);
                 $body = str_replace('%note', $message, $body);
                 $body = str_replace("%message", $message, $body);
                 //Previous versions used message.
                 $body = str_replace("%assignee", $staff->getName(), $body);
                 $body = str_replace("%assigner", $thisuser ? $thisuser->getName() : 'System', $body);
                 if (!($email = $cfg->getAlertEmail())) {
                     $email = $cfg->getDefaultEmail();
                 }
                 if ($email) {
                     $email->send($staff->getEmail(), $subj, $body);
                 }
             } else {
                 Sys::log(LOG_WARNING, 'Template Fetch Error', "Unable to fetch 'assigned' alert template #{$tplId}");
             }
         }
         $message = $message ? $message : 'Ticket assigned';
         //Save the message as internal note...(record).
         $this->postNote('Ticket Assigned to ' . $staff->getName(), $message, false);
         //Notice that we are disabling note alerts!
         return true;
     }
     return false;
 }
 function assignStaff($staffId, $message, $alertstaff = true)
 {
     global $thisuser, $cfg;
     $staff = new Staff($staffId);
     if (!$staff || !$staff->isAvailable() || !$thisuser) {
         return false;
     }
     if ($this->setStaffId($staff->getId())) {
         //Reopen the ticket if cloed.
         if ($this->isClosed()) {
             //Assigned ticket Must be open.
             $this->reopen();
         }
         //Send Notice + Message to assignee. (if directed)
         if ($alertstaff && $staff->getId() != $thisuser->getId()) {
             //No alerts for self assigned.
             //Send Notice + Message to assignee.
             $sql = 'SELECT assigned_alert_subj,assigned_alert_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($cfg->getDefaultTemplateId());
             $resp = db_query($sql);
             if (db_num_rows($resp) && (list($subj, $body) = db_fetch_row($resp))) {
                 $subj = str_replace("%ticket", $this->getExtId(), $subj);
                 $body = str_replace("%ticket", $this->getExtId(), $body);
                 $body = str_replace("%assignee", $staff->getName(), $body);
                 $body = str_replace("%assigner", $thisuser->getName(), $body);
                 $body = str_replace("%message", $message, $body);
                 $body = str_replace("%url", $cfg->getBaseUrl(), $body);
                 Misc::sendmail($staff->getEmail(), $subj, $body, $cfg->getAlertEmail());
             }
         }
         //Save the message as internal note...(record).
         $this->postNote('Ticket Assigned to ' . $staff->getName(), $message);
         return true;
     }
     return false;
 }
    $staff->setSecName($_POST['secondname']);
    $staff->setAdress($_POST['adress']);
    $staff->setCity($_POST['city']);
    $staff->setJbg($_POST['jbg']);
    $staff->setEmail($_POST['email']);
    $staff->setPasswd($_POST['passwd']);
    $staff->setPhone($_POST['phone']);
    $staff->setMphone($_POST['mphone']);
    $staff->setIsStaff($is_staff);
    $staff->setImageUrl($image_url);
    $staff->setPhotoId($photo_id);
    $staff->setWorkPlace($_POST['work_place']);
    $staff->setSalary($_POST['salary']);
    $staff->setIsAdmin($is_admin);
    $staff->setEnabled($enabled);
    $id = $userDao->createStafs($staff->getName(), $staff->getSecName(), $staff->getAdress(), $staff->getCity(), $staff->getJbg(), $staff->getEmail(), $staff->getPasswd(), $staff->getPhone(), $staff->getMphone(), $staff->getIsStaff(), $staff->getImageUrl(), $staff->getPhotoId(), $staff->getWorkPlace(), $staff->getSalary(), $staff->getIsAdmin(), $staff->getEnabled());
}
//print_r("ID nakon createStafs iznosi: ".$id);
$resultsshow = $userDao->showUser($id);
$row = $resultsshow->fetch_assoc();
?>

<div class="main container-fluid">
    <div class="sectionShow">
        <div class="secimg">
            <img src="<?php 
echo $row['image_url'];
?>
" alt="User Photo" style="width:300px;height:200px">
        </div>
        <div class="secol">