Esempio n. 1
0
                 }else{
                      $errors['err']='Uknown command!';
                 }
                 
             }else{
                 $errors['err']='No groups selected.';
             }
     }
 break;
 case 'staff':
     include_once(INCLUDE_DIR.'class.staff.php');
     $do=strtolower($_POST['do']);
     switch($do){
         case 'update':
             $staff = new Staff($_POST['staff_id']);
             if($staff && $staff->getId()) {
                 if($staff->update($_POST,$errors))
                     $msg='Staff profile updated successfully';
                 elseif(!$errors['err'])
                     $errors['err']='Error updating the user';
             }else{
                 $errors['err']='Internal error';
             }
             break;
         case 'create':
             if(($uID=Staff::create($_POST,$errors)))
                 $msg=Format::htmlchars($_POST['firstname'].' '.$_POST['lastname']).' added successfully';
             elseif(!$errors['err'])
                 $errors['err']='Unable to add the user. Internal error';
             break;
         case 'mass_process':
Esempio n. 2
0
 function lookup($id)
 {
     return $id && ($staff = new Staff($id)) && $staff->getId() ? $staff : null;
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 /**
  * 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      Staff $value A Staff object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Staff $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 5
0
 function lookup($id)
 {
     return $id && is_numeric($id) && ($staff = new Staff($id)) && $staff->getId() == $id ? $staff : null;
 }
Esempio n. 6
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();
         }
         //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;
 }
Esempio n. 7
0
    $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($work_place);
    $staff->setSalary($salary);
    $staff->setIsAdmin($is_admin);
    $staff->setEnabled($enabled);
    $id = $userDao->editStafs($staff->getId(), $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->getIsAdmin(), $staff->getEnabled());
}
/*$sql = "SELECT * FROM user JOIN staff ON staff.user_id = user.id WHERE user.id = ".$id;

if (!$results = $connection->query($sql)){
    die('Ne mogu da izvrsim upit zbog ['. $connection->error
        . "]");
}

$row = $results->fetch_assoc();*/
$resultsshow = $userDao->showUser($id);
$row = $resultsshow->fetch_assoc();
?>

<div class="main container-fluid">
    <div class="sectionShow">