Beispiel #1
0
    /**
     * Sets up export options and exports items
     *
     * @return void
     */
    public function onExport()
    {
        $filename = 'export.csv';

        /* Bail out if we don't have a valid data item type. */
        if (!$this->isRequiredIDValid('dataItemType', $_GET))
        {
            CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid data item type.');
        }

        $dataItemType = $_GET['dataItemType'];

        /* Are we in "Only Selected" mode? */
        if ($this->isChecked('onlySelected', $_GET))
        {
            foreach ($_GET as $key => $value)
            {
                if (!strstr($key, 'checked_'))
                {
                    continue;
                }

                $IDs[] = str_replace('checked_', '', $key);
            }
        }
        else
        {
            /* No; do we have a list of IDs to export (Page Mode)? */
            $tempIDs = $this->getTrimmedInput('ids', $_GET);
            if (!empty($tempIDs))
            {
                $IDs = explode(',', $tempIDs);
            }
            else
            {
                /* No; All Records Mode. */
                $IDs = array();
            }
        }

        $export = new Export($dataItemType, $IDs, ',', $this->_siteID);
        $output = $export->getFormattedOutput();

        if (!eval(Hooks::get('EXPORT'))) return;

        header('Content-Disposition: attachment; filename="' . $filename . '"');
        header('Content-Length: ' . strlen($output));
        header('Connection: close');
        header('Content-Type: text/x-csv; name=' . $filename);
        echo $output;exit;
    }
 /**
  * Loads a module.
  *
  * @param string module name
  * @return void
  */
 public static function loadModule($moduleName)
 {
     $modules = self::getModules();
     if (!isset($modules[$moduleName])) {
         if (class_exists('CommonErrors')) {
             CommonErrors::fatal(COMMONERROR_INVALIDMODULE, NULL, $moduleName);
         } else {
             echo 'Invalid module name \'' . htmlspecialchars($moduleName) . '\'.<br />Is the module installed?!';
             die;
         }
     }
     $moduleClass = $modules[$moduleName][0];
     include_once 'modules/' . $moduleName . '/' . $moduleClass . '.php';
     if (!eval(Hooks::get('LOAD_MODULE'))) {
         return;
     }
     $module = new $moduleClass();
     $module->handleRequest();
 }
Beispiel #3
0
 public function careerPortalQuestionnairePreview()
 {
     if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
     }
     if (!isset($_GET['questionnaireID'])) {
         CommonErrors::fatal(COMMONERROR_BADINDEX);
     }
     $questionnaireID = intval($_GET['questionnaireID']);
     $questionnaire = new Questionnaire($this->_siteID);
     $data = $questionnaire->get($questionnaireID);
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX);
     }
     $questions = $questionnaire->getQuestions($questionnaireID);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'Administration');
     $this->_template->assign('isModal', false);
     $this->_template->assign('questionnaireID', $questionnaireID);
     $this->_template->assign('data', $data);
     $this->_template->assign('questions', $questions);
     $this->_template->display('./modules/settings/CareerPortalQuestionnaireShow.tpl');
 }
Beispiel #4
0
 private function importBulkResumes()
 {
     if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
         CommonErrors::fatal(COMMONERROR_NOTLOGGEDIN, $this);
     }
     if ($_SESSION['CATS']->getAccessLevel() < ACCESS_LEVEL_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
     }
     $uploadPath = FileUtility::getUploadPath($this->_siteID, 'massimport');
     $attachments = new Attachments($this->_siteID);
     $bulkResumes = $attachments->getBulkAttachments();
     if (!count($bulkResumes)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this);
     }
     /**
      * Write the parsed resume contents to the new file which will
      * be created as a text document for each bulk attachment.
      */
     foreach ($bulkResumes as $bulkResume) {
         $fullName = $bulkResume['originalFileName'];
         if (!strlen(trim($fullName))) {
             $fullName = 'Untitled';
         }
         $mp = explode('.', $fullName);
         $fileName = implode('.', array_slice($mp, 0, -1));
         if (!@file_exists($newFileName = $uploadPath . '/_BulkResume_' . $fileName . '.txt')) {
             // Some old files are fulltext encoded which makes them a pain for the parser, fixing here:
             $contents = DatabaseSearch::fulltextDecode($bulkResume['text']);
             @file_put_contents($newFileName, $contents);
             chmod($newFileName, 0777);
         }
     }
     CATSUtility::transferRelativeURI('m=import&a=massImport&step=2');
 }
Beispiel #5
0
 private function downloadVCard()
 {
     /* Bail out if we don't have a valid contact ID. */
     if (!$this->isRequiredIDValid('contactID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_GET['contactID'];
     $contacts = new Contacts($this->_siteID);
     $contact = $contacts->get($contactID);
     $companies = new Companies($this->_siteID);
     $company = $companies->get($contact['companyID']);
     /* Bail out if we got an empty result set. */
     if (empty($contact)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified contact ID could not be found.');
     }
     /* Create a new vCard. */
     $vCard = new VCard();
     $vCard->setName($contact['lastName'], $contact['firstName']);
     if (!empty($contact['phoneWork'])) {
         $vCard->setPhoneNumber($contact['phoneWork'], 'PREF;WORK;VOICE');
     }
     if (!empty($contact['phoneCell'])) {
         $vCard->setPhoneNumber($contact['phoneCell'], 'CELL;VOICE');
     }
     /* FIXME: Add fax to contacts and use setPhoneNumber('WORK;FAX') here */
     $addressLines = explode("\n", $contact['address']);
     $address1 = trim($addressLines[0]);
     if (isset($addressLines[1])) {
         $address2 = trim($addressLines[1]);
     } else {
         $address2 = '';
     }
     $vCard->setAddress($address1, $address2, $contact['city'], $contact['state'], $contact['zip']);
     if (!empty($contact['email1'])) {
         $vCard->setEmail($contact['email1']);
     }
     if (!empty($company['url'])) {
         $vCard->setURL($company['url']);
     }
     $vCard->setTitle($contact['title']);
     $vCard->setOrganization($company['name']);
     if (!eval(Hooks::get('CONTACTS_GET_VCARD'))) {
         return;
     }
     $vCard->printVCardWithHeaders();
 }
Beispiel #6
0
    public function onEmailContacts()
    {
        if ($this->_accessLevel == ACCESS_LEVEL_DEMO)
        {
            CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Sorry, but demo accounts are not allowed to send e-mails.');
        }
        Logger::getLogger("AuieoATS")->info("inside onEmailContacts");
        //if (isset($_POST['postback']))
        //{
            $templateid = $_POST['titleSelect'];
            
            $emailTo = $_POST['emailTo'];
            $emailSubject = $_POST['emailSubject'];
            
            $idlist=$_POST["idlist"];
            $obj=json_decode(urldecode($idlist),true);
            foreach($obj as $candid=>$details)
            {
                $emailBody = $_POST['emailBody'];
                $emailData=array();
                $emailData["id"]=$candid;
                $emailData["email"]=array();
                foreach($details["email"] as $emailind=>$data)
                {
                    //$objTemplate=new EmailTemplates($this->_siteID); 
                    //$rowTemplate=$objTemplate->get($templateid);
                    $emailBody=$this->renderTemplateVars($emailBody, $candid);

                    $tmpDestination = $data["email"];
                    $emailData["email"][]=array("email"=>$tmpDestination,"name"=>$tmpDestination);
                    $mailer = new Mailer($this->_siteID);
                    // FIXME: Use sendToOne()?
                    $mailerStatus = $mailer->send(
                        array($_SESSION['CATS']->getEmail(), $_SESSION['CATS']->getEmail()),
                        $emailData,
                        $emailSubject,
                        $emailBody,
                        true,
                        true
                    );
                }
            }

            $this->_template->assign('active', $this);
            $this->_template->assign('success_to', $emailTo);
            if($mailer->getError())
            {
                $this->_template->assign('error', $mailer->getError());
                $this->_template->display('./modules/contacts/emailFail.php');
            }
            else
            {
                $this->_template->assign('success', true);
                $this->_template->display('./modules/contacts/emailSuccess.php');
            }
            return;
        /*}
        else
        {
            if(isset($_REQUEST["idlist"]))
            {
                $db = DatabaseConnection::getInstance();
                $idlist=trim($_REQUEST["idlist"]);
                $rs = $db->getAllAssoc(sprintf(
                    'SELECT candidate_id, email1, email2, last_name, first_name '
                    . 'FROM candidate '
                    . 'WHERE candidate_id IN (%s)',
                    $idlist
                ));
				
                $emailTemplates = new EmailTemplates($this->_siteID);
                $emailTemplatesRS = $emailTemplates->getAll();
                $this->_template->assign('emailTemplatesRS', $emailTemplatesRS);
                $this->_template->assign('active', $this);
                $this->_template->assign('success', true);
                $this->_template->assign('recipients', $rs);
                $this->_template->display('./modules/candidates/emailCandidates.php');
                return;
            }
            else
            {
                $dataGrid = DataGrid::getFromRequest();

                $candidateIDs = $dataGrid->getExportIDs();

                // Validate each ID
                foreach ($candidateIDs as $index => $candidateID)
                {
                    if (!$this->isRequiredIDValid($index, $candidateIDs))
                    {
                        CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.');
                        return;
                    }
                }

                $db_str = implode(", ", $candidateIDs);

                $db = DatabaseConnection::getInstance();

                $rs = $db->getAllAssoc(sprintf(
                    'SELECT candidate_id, email1, email2, last_name, first_name '
                    . 'FROM candidate '
                    . 'WHERE candidate_id IN (%s)',
                    $db_str
                ));

                if(!$mailerStatus)
                {
                    CommonErrors::fatal(COMMONERROR_EMAILFAILED, NULL, $mailer->getError());
                }
                $this->_template->assign('active', $this);
                $this->_template->assign('success', true);
                $this->_template->assign('success_to', $emailTo);
                $this->_template->display('./modules/candidates/emailSuccess.php');

            }
        }*/
    }
Beispiel #7
0
 private function wordVerify()
 {
     if (!$this->isRequiredIDValid('wordVerifyID', $_GET) && !isset($_GET['wordVerifyString'])) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid word verification ID.');
     }
     if (isset($_GET['wordVerifyID'])) {
         $wordVerifyID = $_GET['wordVerifyID'];
         $graphs = new Graphs();
         $text = $graphs->getVerificationImageText($wordVerifyID);
     } else {
         $text = $_GET['wordVerifyString'];
     }
     $graph = new WordVerify($text);
     $graph->draw();
     die;
 }
Beispiel #8
0
    public function quickSearch()
    {
        /* Bail out to prevent an error if the GET string doesn't even contain
         * a field named 'quickSearchFor' at all.
         */
        if (!isset($_GET['quickSearchFor']))
        {
            CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'No query string specified.');
        }

        $query = trim($_GET['quickSearchFor']);
        $wildCardQuickSearch = $query;
        
        $search = new QuickSearch($this->_siteID);
        $candidatesRS = $search->candidates($query);
        $companiesRS  = $search->companies($query);
        $contactsRS   = $search->contacts($query);
        $jobOrdersRS  = $search->jobOrders($query);
        //$listsRS      = $search->lists($query);

        if (!empty($candidatesRS))
        {
            foreach ($candidatesRS as $rowIndex => $row)
            {
                if (!empty($candidatesRS[$rowIndex]['ownerFirstName']))
                {
                    $candidatesRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                        $candidatesRS[$rowIndex]['ownerFirstName'],
                        $candidatesRS[$rowIndex]['ownerLastName'],
                        false,
                        LAST_NAME_MAXLEN
                    );
                }
                else
                {
                    $candidatesRS[$rowIndex]['ownerAbbrName'] = 'None';
                }

                if (empty($candidatesRS[$rowIndex]['phoneHome']))
                {
                    $candidatesRS[$rowIndex]['phoneHome'] = 'None';
                }

                if (empty($candidatesRS[$rowIndex]['phoneCell']))
                {
                    $candidatesRS[$rowIndex]['phoneCell'] = 'None';
                }
            }
        }

        if (!empty($companiesRS))
        {
            foreach ($companiesRS as $rowIndex => $row)
            {
                if (!empty($companiesRS[$rowIndex]['ownerFirstName']))
                {
                    $companiesRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                        $companiesRS[$rowIndex]['ownerFirstName'],
                        $companiesRS[$rowIndex]['ownerLastName'],
                        false,
                        LAST_NAME_MAXLEN
                    );
                }
                else
                {
                    $companiesRS[$rowIndex]['ownerAbbrName'] = 'None';
                }

                if (empty($companiesRS[$rowIndex]['phone1']))
                {
                    $companiesRS[$rowIndex]['phone1'] = 'None';
                }
            }
        }

        if (!empty($contactsRS))
        {
            foreach ($contactsRS as $rowIndex => $row)
            {

                if ($contactsRS[$rowIndex]['isHotContact'] == 1)
                {
                    $contactsRS[$rowIndex]['linkClassContact'] = 'jobLinkHot';
                }
                else
                {
                    $contactsRS[$rowIndex]['linkClassContact'] = 'jobLinkCold';
                }

                if ($contactsRS[$rowIndex]['leftCompany'] == 1)
                {
                    $contactsRS[$rowIndex]['linkClassCompany'] = 'jobLinkDead';
                }
                else if ($contactsRS[$rowIndex]['isHotCompany'] == 1)
                {
                    $contactsRS[$rowIndex]['linkClassCompany'] = 'jobLinkHot';
                }
                else
                {
                    $contactsRS[$rowIndex]['linkClassCompany'] = 'jobLinkCold';
                }

                if (!empty($contactsRS[$rowIndex]['ownerFirstName']))
                {
                    $contactsRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                        $contactsRS[$rowIndex]['ownerFirstName'],
                        $contactsRS[$rowIndex]['ownerLastName'],
                        false,
                        LAST_NAME_MAXLEN
                    );
                }
                else
                {
                    $contactsRS[$rowIndex]['ownerAbbrName'] = 'None';
                }

                if (empty($contactsRS[$rowIndex]['phoneWork']))
                {
                    $contactsRS[$rowIndex]['phoneWork'] = 'None';
                }

                if (empty($contactsRS[$rowIndex]['phoneCell']))
                {
                    $contactsRS[$rowIndex]['phoneCell'] = 'None';
                }
            }
        }

        if (!empty($jobOrdersRS))
        {
            foreach ($jobOrdersRS as $rowIndex => $row)
            {
                if ($jobOrdersRS[$rowIndex]['startDate'] == '00-00-00')
                {
                    $jobOrdersRS[$rowIndex]['startDate'] = '';
                }

                if ($jobOrdersRS[$rowIndex]['isHot'] == 1)
                {
                    $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkHot';
                }
                else
                {
                    $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkCold';
                }

                if (!empty($jobOrdersRS[$rowIndex]['recruiterAbbrName']))
                {
                    $jobOrdersRS[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName(
                        $jobOrdersRS[$rowIndex]['recruiterFirstName'],
                        $jobOrdersRS[$rowIndex]['recruiterLastName'],
                        false,
                        LAST_NAME_MAXLEN
                    );
                }
                else
                {
                    $jobOrdersRS[$rowIndex]['recruiterAbbrName'] = 'None';
                }

                if (!empty($jobOrdersRS[$rowIndex]['ownerFirstName']))
                {
                    $jobOrdersRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName(
                        $jobOrdersRS[$rowIndex]['ownerFirstName'],
                        $jobOrdersRS[$rowIndex]['ownerLastName'],
                        false,
                        LAST_NAME_MAXLEN
                    );
                }
                else
                {
                    $jobOrdersRS[$rowIndex]['ownerAbbrName'] = 'None';
                }
            }
        }

        $this->_template->assign('active', $this);
        $this->_template->assign('jobOrdersRS', $jobOrdersRS);
        $this->_template->assign('candidatesRS', $candidatesRS);
        $this->_template->assign('companiesRS', $companiesRS);
        $this->_template->assign('contactsRS', $contactsRS);
        //$this->_template->assign('listsRS', $listsRS);
        $this->_template->assign('wildCardQuickSearch', $wildCardQuickSearch);

        if (!eval(Hooks::get('HOME_QUICK_SEARCH'))) return;

        $this->_template->display('./modules/home/SearchEverything.php');
    }
Beispiel #9
0
    public function onDeleteEvent()
    {
        if ($this->_accessLevel < ACCESS_LEVEL_DELETE)
        {
            CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
        }

        /* Bail out if we don't have a valid event ID. */
        if (!$this->isRequiredIDValid('eventID', $_GET))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid event ID.');
        }

        $eventID = $_GET['eventID'];

        if (!eval(Hooks::get('CALENDAR_DELETE_PRE'))) return;

        $calendar = new Calendar($this->_siteID);
        $calendar->deleteEvent($eventID);

        if (!eval(Hooks::get('CALENDAR_DELETE_POST'))) return;

        /* Transfer to same url without a=deleteEvent or eventID. */
        $newGet = $_GET;
        $newParams = array();

        unset($newGet['a']);
        unset($newGet['eventID']);

        foreach ($newGet AS $name => $value)
        {
            $newParams[] = urlencode($name).'='.urlencode($value);
        }

        CATSUtility::transferRelativeURI(implode('&', $newParams));
    }
Beispiel #10
0
 private function administrativeHideShow()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_MULTI_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
     }
     /* Bail out if we don't have a valid joborder ID. */
     if (!$this->isRequiredIDValid('jobOrderID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid Job Order ID.');
     }
     /* Bail out if we don't have a valid status ID. */
     if (!$this->isRequiredIDValid('state', $_GET, true)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid state ID.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     // FIXME: Checkbox?
     (bool) ($state = $_GET['state']);
     $joborders = new JobOrders($this->_siteID);
     $joborders->administrativeHideShow($jobOrderID, $state);
     CATSUtility::transferRelativeURI('m=joborders&a=show&jobOrderID=' . $jobOrderID);
 }
Beispiel #11
0
    public function onApplyToJobOrder($siteID, $candidateID = false)
    {
        $jobOrders = new JobOrders($siteID);
        $careerPortalSettings = new CareerPortalSettings($siteID);

        if (!$this->isRequiredIDValid('ID', $_POST))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
            return;
        }

        $jobOrderID = $_POST['ID'];

        $jobOrderData = $jobOrders->get($jobOrderID);
        if (!isset($jobOrderData['public']) || $jobOrderData['public'] == 0)
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order could not be found.');
            return;
        }

        $lastName       = $this->getTrimmedInput('lastName', $_POST);
        $middleName     = $this->getTrimmedInput('middleName', $_POST);
        $firstName      = $this->getTrimmedInput('firstName', $_POST);
        $email          = $this->getTrimmedInput('email', $_POST);
        $email2         = $this->getTrimmedInput('email2', $_POST);
        $address        = $this->getTrimmedInput('address', $_POST);
        $city           = $this->getTrimmedInput('city', $_POST);
        $state          = $this->getTrimmedInput('state', $_POST);
        $zip            = $this->getTrimmedInput('zip', $_POST);
        $source         = $this->getTrimmedInput('source', $_POST);
        $phone          = $this->getTrimmedInput('phone', $_POST);
        $phoneHome      = $this->getTrimmedInput('phoneHome', $_POST);
        $phoneCell      = $this->getTrimmedInput('phoneCell', $_POST);
        $bestTimeToCall = $this->getTrimmedInput('bestTimeToCall', $_POST);
        $keySkills      = $this->getTrimmedInput('keySkills', $_POST);
        $extraNotes     = $this->getTrimmedInput('extraNotes', $_POST);
        $employer       = $this->getTrimmedInput('employer', $_POST);

        $gender         = $this->getTrimmedInput('eeogender', $_POST);
        $race           = $this->getTrimmedInput('eeorace', $_POST);
        $veteran        = $this->getTrimmedInput('eeoveteran', $_POST);
        $disability     = $this->getTrimmedInput('eeodisability', $_POST);

        if (empty($firstName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'First Name is a required field - please have your administrator edit your templates to include the first name field.');
        }

        if (empty($lastName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Last Name is a required field - please have your administrator edit your templates to include the last name field.');
        }

        if (empty($email))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'E-Mail address is a required field - please have your administrator edit your templates to include the email field.');
        }

        if (empty($source))
        {
            $source = 'Online Careers Website';
        }

        $users = new Users(CATS_ADMIN_SITE);
        $automatedUser = $users->getAutomatedUser();

        /* Find if another user with same e-mail exists. If so, update the user
         * to contain the new information.
         */
        $candidates = new Candidates($siteID);

        /**
         * Save basic information in a cookie in case the site is using registration to
         * process repeated postings, etc.
         */
        $fields = array('firstName', 'lastName', 'email', 'address', 'city', 'state', 'zip', 'phone',
            'phoneHome', 'phoneCell'
        );
        $storedVal = '';
        foreach ($fields as $field)
        {
            eval('$tmp = sprintf(\'"%s"="%s"\', $field, urlencode($' . $field . '));');
            $storedVal .= $tmp;
        }
        // Store their information for an hour only (about 1 session), if they return they can log in again and
        // specify "remember me" which stores it for 2 weeks.
        @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60);

        if ($candidateID !== false)
        {
            $candidate = $candidates->get($candidateID);

            // Candidate exists and registered. Update their profile with new values (if provided)
            $candidates->update(
                $candidateID, $candidate['isActive'] ? true : false, $firstName, $middleName,
                $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city,
                $state, $zip, $source, $keySkills, '', $employer, '', '', '', $candidate['notes'],
                '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender,
                $race, $veteran, $disability
            );

            /* Update extra feilds */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }
        else
        {
            // Lookup the candidate by e-mail, use that candidate instead if found (but don't update profile)
            $candidateID = $candidates->getIDByEmail($email);
        }

        if ($candidateID === false || $candidateID < 0)
        {
            /* New candidate. */
            $candidateID = $candidates->add(
                $firstName,
                $middleName,
                $lastName,
                $email,
                $email2,
                $phoneHome,
                $phoneCell,
                $phone,
                $address,
                $city,
                $state,
                $zip,
                $source,
                $keySkills,
                '',
                $employer,
                '',
                '',
                '',
                'Candidate submitted these notes with first application: '
                . "\n\n" . $extraNotes,
                '',
                $bestTimeToCall,
                $automatedUser['userID'],
                $automatedUser['userID'],
                $gender,
                $race,
                $veteran,
                $disability
            );

            /* Update extra fields. */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }

        // If the candidate was added and a questionnaire exists for the job order
        if ($candidateID > 0 && ($questionnaireID = $jobOrderData['questionnaireID']))
        {
            $questionnaireLib = new Questionnaire($siteID);
            // Perform any actions specified by the questionnaire
            $questionnaireLib->doActions($questionnaireID, $candidateID, $_POST);
        }

        $fileUploaded = false;

        /* Upload resume (no questionnaire) */
        if (isset($_FILES['file']) && !empty($_FILES['file']['name']))
        {
            $attachmentCreator = new AttachmentCreator($siteID);
            $attachmentCreator->createFromUpload(
                DATA_ITEM_CANDIDATE, $candidateID, 'file', false, true
            );

            if ($attachmentCreator->isError())
            {
                CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                return;
            }

            $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

            $isTextExtractionError = $attachmentCreator->isTextExtractionError();
            $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

            // FIXME: Show parse errors!

            $fileUploaded = true;
            $resumePath = $attachmentCreator->getNewFilePath();
        }
        /* Upload resume (with questionnaire) */
        else if (isset($_POST['file']) && !empty($_POST['file']))
        {
            $resumePath = '';

            $newFilePath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $_POST['file']);

            if ($newFilePath !== false)
            {
                $attachmentCreator = new AttachmentCreator($siteID);
                $attachmentCreator->createFromFile(
                    DATA_ITEM_CANDIDATE, $candidateID, $newFilePath, false, '', true, true
                );

                if ($attachmentCreator->isError())
                {
                    CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                    return;
                }

                $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

                $isTextExtractionError = $attachmentCreator->isTextExtractionError();
                $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

                // FIXME: Show parse errors!

                $fileUploaded = true;
                $resumePath = $attachmentCreator->getNewFilePath();
            }
        }

        $pipelines = new Pipelines($siteID);
        $activityEntries = new ActivityEntries($siteID);

        /* Is the candidate already in the pipeline for this job order? */
        $rs = $pipelines->get($candidateID, $jobOrderID);
        if (count($rs) == 0)
        {
            /* Attempt to add the candidate to the pipeline. */
            if (!$pipelines->add($candidateID, $jobOrderID))
            {
                CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add candidate to pipeline.');
            }

            // FIXME: For some reason, pipeline entries like to disappear between
            //        the above add() and this get(). WTF?
            $rs = $pipelines->get($candidateID, $jobOrderID);
            if (isset($rs['candidateJobOrderID']))
                $pipelines->updateRatingValue($rs['candidateJobOrderID'], -1);

            $newApplication = true;
        }
        else
        {
            $newApplication = false;
        }

        /* Build activity note. */
        if (!$newApplication)
        {
            $activityNote = 'User re-applied through candidate portal';
        }
        else
        {
            $activityNote = 'User applied through candidate portal';
        }

        if ($fileUploaded)
        {
            if (!$duplicatesOccurred)
            {
                $activityNote .= ' <span style="font-weight: bold;">and'
                    . ' attached a new resume (<a href="' . $resumePath
                    . '">Download</a>)</span>';
            }
            else
            {
                $activityNote .= ' and attached an existing resume (<a href="'
                    . $resumePath . '">Download</a>)';
            }
        }

		if (!empty($extraNotes))
		{
        	$activityNote .= '; added these notes: ' . $extraNotes;
		}

        /* Add the activity note. */
        $activityID = $activityEntries->add(
            $candidateID,
            DATA_ITEM_CANDIDATE,
            ACTIVITY_OTHER,
            $activityNote,
            $automatedUser['userID'],
            $jobOrderID
        );

        /* Send an E-Mail describing what happened. */
        $emailTemplates = new EmailTemplates($siteID);
        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEAPPLY'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        /* Replace e-mail template variables. */
        /* E-Mail #1 - to candidate */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%JBODTITLE%',
            '%JBODCLIENT%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName']

            //'<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
              //  'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>'
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$candidates->isLoaded())
            {
                $candidates->load($candidateID);
            }
            $candidates->sendEMail(
                $automatedUser['userID'],
                $email,
                CAREERS_CANDIDATEAPPLY_SUBJECT,
                $emailContents
            );
        }

        /* E-Mail #2 - to owner */

        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEPORTALNEW'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        // FIXME: This will break if 'http' is elsewhere in the URL.
        $uri = str_replace('employment', '', $_SERVER['REQUEST_URI']);
        $uri = str_replace('http://', 'http', $uri);
        $uri = str_replace('//', '/', $uri);
        $uri = str_replace('http', 'http://', $uri);
        $uri = str_replace('/careers', '', $uri);

        /* Replace e-mail template variables. */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%CANDOWNER%',     // Because the candidate was just added, we assume
            '%JBODTITLE%',     // the candidate owner = job order owner.
            '%JBODCLIENT%',
            '%CANDCATSURL%',
            '%JBODID%',
            '%JBODCATSURL%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>',
            $jobOrderData['jobOrderID'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '</a>',
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$jobOrders->isLoaded())
            {
                $jobOrders->load($jobOrderID);
            }
            $jobOrders->sendEmail(
                $automatedUser['userID'],
                $jobOrderData['owner_email'],
                CAREERS_OWNERAPPLY_SUBJECT,
                $emailContents
            );


            if ($jobOrderData['owner_email'] != $jobOrderData['recruiter_email'])
            {
                $jobOrders->sendEmail(
                    $automatedUser['userID'],
                    $jobOrderData['recruiter_email'],
                    CAREERS_OWNERAPPLY_SUBJECT,
                    $emailContents
                );
            }
        }
    }
Beispiel #12
0
    public function onSearch()
    {
        $periodString = $this->getTrimmedInput('period', $_GET);
        if (!empty($periodString) &&
            in_array($periodString, array('lastweek', 'lastmonth', 'lastsixmonths', 'lastyear', 'all')))
        {
            /* formats start and end date for searching */
            switch ($periodString)
            {
                case 'lastweek':
                    $period = 'DATE_SUB(CURDATE(), INTERVAL 1 WEEK)';
                    break;

                case 'lastmonth':
                    $period = 'DATE_SUB(CURDATE(), INTERVAL 1 MONTH)';
                    break;

                case 'lastsixmonths':
                    $period = 'DATE_SUB(CURDATE(), INTERVAL 6 MONTH)';
                    break;

                case 'lastyear':
                    $period = 'DATE_SUB(CURDATE(), INTERVAL 1 YEAR)';
                    break;

                case 'all':
                default:
                    $period = '';
                    break;
            }

            $startDate = '';
            $endDate = '';

            $startDateURLString = '';
            $endDateURLString   = '';
        }
        else
        {
            /* Do we have a valid starting date? */
            if (!$this->isRequiredIDValid('startDay', $_GET) ||
                !$this->isRequiredIDValid('startMonth', $_GET) ||
                !$this->isRequiredIDValid('startYear', $_GET))
            {
                CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid starting date.');
            }

            /* Do we have a valid ending date? */
            if (!$this->isRequiredIDValid('endDay', $_GET) ||
                !$this->isRequiredIDValid('endMonth', $_GET) ||
                !$this->isRequiredIDValid('endYear', $_GET))
            {
                CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid ending date.');
            }

            if (!checkdate($_GET['startMonth'], $_GET['startDay'], $_GET['startYear']))
            {
                CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid starting date.');
            }

            if (!checkdate($_GET['endMonth'], $_GET['endDay'], $_GET['endYear']))
            {
                CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid ending date.');
            }

            /* formats start and end date for searching */
            $startDate = DateUtility::formatSearchDate(
                $_GET['startMonth'], $_GET['startDay'], $_GET['startYear']
            );
            $endDate = DateUtility::formatSearchDate(
                $_GET['endMonth'], $_GET['endDay']+1, $_GET['endYear']
            );

            $startDateURLString = sprintf(
                '&amp;startMonth=%s&amp;startDay=%s&amp;startYear=%s',
                $_GET['startMonth'],
                $_GET['startDay'],
                $_GET['startYear']
            );

            $endDateURLString = sprintf(
                '&amp;endMonth=%s&amp;endDay=%s&amp;endYear=%s',
                $_GET['endMonth'],
                $_GET['endDay'],
                $_GET['endYear']
            );

            $period = '';
        }

        $baseURL = sprintf(
            'm=activity&amp;a=viewByDate&amp;getback=getback%s%s',
            $startDateURLString, $endDateURLString
        );

        $dataGridProperties = DataGrid::getRecentParamaters("activity:ActivityDataGrid");

        /* If this is the first time we visited the datagrid this session, the recent paramaters will
         * be empty.  Fill in some default values. */
        if ($dataGridProperties == array())
        {
            $dataGridProperties = array(
                'rangeStart'    => 0,
                'maxResults'    => 15,
                'filterVisible' => false
            );
        }

        $dataGridProperties['startDate'] = $startDate;
        $dataGridProperties['endDate']   = $endDate;
        $dataGridProperties['period']    = $period;

        $dataGrid = DataGrid::get("activity:ActivityDataGrid", $dataGridProperties);

        $quickLinks = $this->getQuickLinks();

        if (!eval(Hooks::get('ACTIVITY_LIST_BY_VIEW_DG'))) return;

        $this->_template->assign('quickLinks', $quickLinks);
        $this->_template->assign('active', $this);
        $this->_template->assign('dataGrid', $dataGrid);
        $this->_template->assign('userID', $_SESSION['CATS']->getUserID());
        
        $activityEntries = new ActivityEntries($this->_siteID);
        $this->_template->assign('numActivities', $activityEntries->getCount());

        $this->_template->display('./modules/activity/ActivityDataGrid.php');
    }
Beispiel #13
0
 private function onShowQuestionnaire()
 {
     $candidateID = isset($_GET[$id = 'candidateID']) ? $_GET[$id] : false;
     $title = isset($_GET[$id = 'questionnaireTitle']) ? urldecode($_GET[$id]) : false;
     $printOption = isset($_GET[$id = 'print']) ? $_GET[$id] : '';
     $printValue = !strcasecmp($printOption, 'yes') ? true : false;
     if (!$candidateID || !$title) {
         CommonErrors::fatal(COMMONERROR_BADINDEX);
     }
     $candidates = new Candidates($this->_siteID);
     $cData = $candidates->get($candidateID);
     $questionnaire = new Questionnaire($this->_siteID);
     $qData = $questionnaire->getCandidateQuestionnaire($candidateID, $title);
     $attachment = new Attachments($this->_siteID);
     $attachments = $attachment->getAll(DATA_ITEM_CANDIDATE, $candidateID);
     if (!empty($attachments)) {
         $resume = $candidates->getResume($attachments[0]['attachmentID']);
         $this->_template->assign('resumeText', str_replace("\n", "<br \\>\n", htmlentities(DatabaseSearch::fulltextDecode($resume['text']))));
         $this->_template->assign('resumeTitle', htmlentities($resume['title']));
     }
     $this->_template->assign('active', $this);
     $this->_template->assign('candidateID', $candidateID);
     $this->_template->assign('title', $title);
     $this->_template->assign('cData', $cData);
     $this->_template->assign('qData', $qData);
     $this->_template->assign('print', $printValue);
     $this->_template->display('./modules/candidates/Questionnaire.tpl');
 }
Beispiel #14
0
 /**
  * Loads a module.
  *
  * @param string module name
  * @return void
  */
 public static function loadModule($moduleName)
 {
     $modules = self::getModules();
     if (!isset($modules[$moduleName])) {
         if (class_exists('CommonErrors')) {
             CommonErrors::fatal(COMMONERROR_INVALIDMODULE, NULL, $moduleName);
         } else {
             echo 'Invalid module name \'' . htmlspecialchars($moduleName) . '\'.<br />Is the module installed?!';
             die;
         }
     }
     $moduleClass = $modules[$moduleName][0];
     if ($_SESSION["CATS"]->getSiteID() > 0) {
         $objPRGManagement = PRGManagement::getInstance();
         $permit = $objPRGManagement->isModuleActionPermitted();
         if ($permit === false) {
             header("Location:index.php");
             exit;
         }
     }
     include_once 'modules/' . $moduleName . '/' . $moduleClass . '.php';
     if (!eval(Hooks::get('LOAD_MODULE'))) {
         return;
     }
     $objModuleController = new $moduleClass();
     $actionExist = false;
     $ret = null;
     //$moduleModelClass="Cls".ucfirst($moduleName)."Model";
     //$moduleViewClass="Cls".ucfirst($moduleName)."View";
     $moduleActionModelClass = "";
     $moduleActionViewClass = "";
     if (isset($_REQUEST['a']) && !empty($_REQUEST['a'])) {
         $action = $_REQUEST['a'];
     } else {
         if (isset($_REQUEST['p']) && $_REQUEST['p'] != "onApplyToJobOrder") {
             $action = $_REQUEST['p'];
         } else {
             $action = "listing";
         }
     }
     $moduleActionViewClass = "Cls" . ucfirst($moduleName) . ucfirst($action) . "View";
     $moduleActionModelClass = "Cls" . ucfirst($moduleName) . ucfirst($action) . "Model";
     $actionMethod = $action;
     if (isset($_POST['postback']) || isset($_GET['getback'])) {
         $actionMethod = "on" . ucfirst($action);
     }
     /**
      * set model object if exist
      */
     if (!class_exists($moduleActionModelClass) && file_exists("modules/{$moduleName}/{$moduleActionModelClass}.php")) {
         include_once "modules/{$moduleName}/{$moduleActionModelClass}.php";
     }
     $objModel = null;
     if (class_exists($moduleActionModelClass)) {
         $objModel = new $moduleActionModelClass();
     }
     /**
      * set view object if exist
      */
     if (!class_exists($moduleActionViewClass) && file_exists("modules/{$moduleName}/{$moduleActionViewClass}.php")) {
         include_once "modules/{$moduleName}/{$moduleActionViewClass}.php";
     }
     $objView = null;
     if (class_exists($moduleActionViewClass)) {
         if (is_null($objModel)) {
             $objView = new $moduleActionViewClass();
         } else {
             $objView = new $moduleActionViewClass($objModel);
         }
         if (method_exists($objModuleController, "setView")) {
             $objModuleController->setView($objView);
         }
     }
     if (defined("AUIEO_API")) {
         include_once "lib/api.php";
         $api = new API();
         $suceess = $api->processApi();
         /**
          * if request is proper process the request
          */
         if ($suceess) {
             $webserviceMethod = "webservice" . ucfirst($action);
             if (method_exists($objModuleController, $webserviceMethod)) {
                 $ret = $objModuleController->{$webserviceMethod}($api);
                 exit;
             }
         } else {
             exit;
         }
     } else {
         if (method_exists($objModuleController, $actionMethod)) {
             $ret = $objModuleController->{$actionMethod}();
         } else {
             if (method_exists($objModuleController, $action)) {
                 $ret = $objModuleController->{$action}();
             } else {
                 if (method_exists($objModuleController, "render")) {
                     $ret = $objModuleController->render();
                 } else {
                     $ret = $objModuleController->handleRequest();
                 }
             }
         }
     }
     /**
      * if it is werservice and if the method exist, the control should not come here.
      * Since it came, it means the webservice method not exist
      */
     if (defined("AUIEO_API")) {
         $api->response('', 404);
         exit;
     }
     $objTemplate = $objModuleController->getTemplateObject();
     if (!$objTemplate->isRendered()) {
         if (isset($_REQUEST["file"])) {
             include_once "./modules/{$moduleName}/{$_REQUEST["file"]}.php";
         }
         if (isset($objTemplate->errMessage) && $objTemplate->errMessage && file_exists("./modules/{$moduleName}/ErrorMessage.php")) {
             $tplfile = "./modules/{$moduleName}/ErrorMessage.php";
         } else {
             if ($action == "listing") {
                 if (!isset($objTemplate->totalRecords) || $objTemplate->totalRecords > 0 || !file_exists("./modules/{$moduleName}/{$action}.php")) {
                     $tplfile = "./modules/{$moduleName}/{$action}.php";
                 } else {
                     $tplfile = "./modules/{$moduleName}/NoRecord.php";
                 }
             } else {
                 $tplfile = "./modules/{$moduleName}/{$action}.php";
             }
         }
         if ($objModuleController->isViewSet()) {
             $objTemplate->display($tplfile, $objModuleController->getView());
         } else {
             $objTemplate->display($tplfile);
         }
     }
 }
Beispiel #15
0
 private function onEdit()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_EDIT) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     $companies = new Companies($this->_siteID);
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_POST)) {
         $this->listByView('Invalid company ID.');
         return;
     }
     /* Bail out if we don't have a valid owner user ID. */
     if (!$this->isOptionalIDValid('owner', $_POST)) {
         $this->listByView('Invalid owner user ID.');
         return;
     }
     /* Bail out if we don't have a valid billing contact ID. */
     if (!$this->isOptionalIDValid('billingContact', $_POST)) {
         $this->listByView('Invalid billing contact ID.');
         return;
     }
     $formattedPhone1 = StringUtility::extractPhoneNumber($this->getTrimmedInput('phone1', $_POST));
     if (!empty($formattedPhone1)) {
         $phone1 = $formattedPhone1;
     } else {
         $phone1 = $this->getTrimmedInput('phone1', $_POST);
     }
     $formattedPhone2 = StringUtility::extractPhoneNumber($this->getTrimmedInput('phone2', $_POST));
     if (!empty($formattedPhone2)) {
         $phone2 = $formattedPhone2;
     } else {
         $phone2 = $this->getTrimmedInput('phone2', $_POST);
     }
     $formattedFaxNumber = StringUtility::extractPhoneNumber($this->getTrimmedInput('faxNumber', $_POST));
     if (!empty($formattedFaxNumber)) {
         $faxNumber = $formattedFaxNumber;
     } else {
         $faxNumber = $this->getTrimmedInput('faxNumber', $_POST);
     }
     $url = $this->getTrimmedInput('url', $_POST);
     if (!empty($url)) {
         $formattedURL = StringUtility::extractURL($url);
         if (!empty($formattedURL)) {
             $url = $formattedURL;
         }
     }
     /* Hot company? */
     $isHot = $this->isChecked('isHot', $_POST);
     $companyID = $_POST['companyID'];
     $owner = $_POST['owner'];
     $billingContact = $_POST['billingContact'];
     /* Change ownership email? */
     if ($this->isChecked('ownershipChange', $_POST) && $owner > 0) {
         $companyDetails = $companies->get($companyID);
         $users = new Users($this->_siteID);
         $ownerDetails = $users->get($_POST['owner']);
         if (!empty($ownerDetails)) {
             $emailAddress = $ownerDetails['email'];
             /* Get the change status email template. */
             $emailTemplates = new EmailTemplates($this->_siteID);
             $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCLIENT');
             if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) {
                 $statusChangeTemplate = '';
             } else {
                 $statusChangeTemplate = $statusChangeTemplateRS['textReplaced'];
             }
             /* Replace e-mail template variables. */
             $stringsToFind = array('%CLNTOWNER%', '%CLNTNAME%', '%CLNTCATSURL%');
             $replacementStrings = array($ownerDetails['fullName'], $companyDetails['name'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=companies&amp;a=show&amp;companyID=' . $companyID . '">' . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=companies&amp;a=show&amp;companyID=' . $companyID . '</a>');
             $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate);
             $email = $statusChangeTemplate;
         } else {
             $email = '';
             $emailAddress = '';
         }
     } else {
         $email = '';
         $emailAddress = '';
     }
     $name = $this->getTrimmedInput('name', $_POST);
     $address = $this->getTrimmedInput('address', $_POST);
     $city = $this->getTrimmedInput('city', $_POST);
     $state = $this->getTrimmedInput('state', $_POST);
     $zip = $this->getTrimmedInput('zip', $_POST);
     $keyTechnologies = $this->getTrimmedInput('keyTechnologies', $_POST);
     $notes = $this->getTrimmedInput('notes', $_POST);
     /* Departments list editor. */
     $departmentsCSV = $this->getTrimmedInput('departmentsCSV', $_POST);
     /* Bail out if any of the required fields are empty. */
     if (empty($name)) {
         $this->listByView('Required fields are missing.');
         return;
     }
     if (!eval(Hooks::get('CLIENTS_ON_EDIT_PRE'))) {
         return;
     }
     $departments = $companies->getDepartments($companyID);
     $departmentsDifferences = ListEditor::getDifferencesFromList($departments, 'name', 'departmentID', $departmentsCSV);
     $companies->updateDepartments($companyID, $departmentsDifferences);
     if (!$companies->update($companyID, $name, $address, $city, $state, $zip, $phone1, $phone2, $faxNumber, $url, $keyTechnologies, $isHot, $notes, $owner, $billingContact, $email, $emailAddress)) {
         CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to update company.');
     }
     if (!eval(Hooks::get('CLIENTS_ON_EDIT_POST'))) {
         return;
     }
     /* Update extra fields. */
     $companies->extraFields->setValuesOnEdit($companyID);
     /* Update contacts? */
     if (isset($_POST['updateContacts'])) {
         if ($_POST['updateContacts'] == 'yes') {
             $contacts = new Contacts($this->_siteID);
             $contacts->updateByCompany($companyID, $address, $city, $state, $zip);
         }
     }
     CATSUtility::transferRelativeURI('m=companies&a=show&companyID=' . $companyID);
 }
Beispiel #16
0
    public function customizeJobOrderReport()
    {
        /* Bail out if we don't have a valid candidate ID. */
        if (!$this->isRequiredIDValid('jobOrderID', $_GET))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
        }

        $jobOrderID = $_GET['jobOrderID'];

        $siteName = $_SESSION['CATS']->getSiteName();


        $statistics = new Statistics($this->_siteID);
        $data = $statistics->getJobOrderReport($jobOrderID);

        /* Bail out if we got an empty result set. */
        if (empty($data))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order ID could not be found.');
        }

        $reportParameters['siteName'] = $siteName;
        $reportParameters['companyName'] = $data['companyName'];
        $reportParameters['jobOrderName'] = $data['title'];
        $reportParameters['accountManager'] = $data['ownerFullName'];
        $reportParameters['recruiter'] = $data['recruiterFullName'];

        $reportParameters['periodLine'] = sprintf(
            '%s - %s',
            strtok($data['dateCreated'], ' '),
            DateUtility::getAdjustedDate('m-d-y')
        );

        $reportParameters['dataSet1'] = $data['pipeline'];
        $reportParameters['dataSet2'] = $data['submitted'];
        $reportParameters['dataSet3'] = $data['pipelineInterving'];
        $reportParameters['dataSet4'] = $data['pipelinePlaced'];

        $dataSet = array(
            $reportParameters['dataSet4'],
            $reportParameters['dataSet3'],
            $reportParameters['dataSet2'],
            $reportParameters['dataSet1']
        );

        $this->_template->assign('reportParameters', $reportParameters);
        $this->_template->assign('active', $this);
        $this->_template->assign('subActive', '');
        $this->_template->display('./modules/reports/JobOrderReport.php');
    }
Beispiel #17
0
    public function getAttachment()
    {
        // FIXME: Do we really need to mess with memory limits here? We're only reading ~80KB at a time...
        @ini_set('memory_limit', '128M'); 
        
        if (!$this->isRequiredIDValid('id', $_GET))
        {
            CommonErrors::fatal(
                COMMONERROR_BADINDEX, $this, 'No attachment ID specified.'
            );
        }

        $attachmentID = $_GET['id'];

        $attachments = new Attachments(-1);
        $rs = $attachments->get($attachmentID, false);

        if (empty($rs) || md5($rs['directoryName']) != $_GET['directoryNameHash'])
        {
            CommonErrors::fatal(
                COMMONERROR_BADFIELDS,
                $this,
                'Invalid id / directory / filename, or you do not have permission to access this attachment.'
            );
        }
        
        $directoryName = $rs['directoryName'];
        $fileName      = $rs['storedFilename'];
        $filePath      = sprintf('attachments/%s/%s', $directoryName, $fileName);

        /* Check for the existence of the backup.  If it is gone, send the user to a page informing them to press back and generate the backup again. */
        if ($rs['contentType'] == 'catsbackup' && !file_exists($filePath))
        {
            CommonErrors::fatal(
                COMMONERROR_FILENOTFOUND,
                $this,
                'The specified backup file no longer exists. Please go back and regenerate the backup before downloading. We are sorry for the inconvenience.'
            );
        }
        
        // FIXME: Stream file rather than redirect? (depends on download preparer working).
        if (!eval(Hooks::get('ATTACHMENT_RETRIEVAL'))) return;

        /* Determine MIME content type of the file. */
        $contentType = Attachments::fileMimeType($fileName);

        /* Open the file and verify that it is readable. */
        $fp = @fopen($filePath, 'r');
        if ($fp === false)
        {
            CommonErrors::fatal(
                COMMONERROR_BADFIELDS,
                $this,
                'This attachment is momentarily offline, please try again later. The support staff has been notified.'
            );
        }

        /* Set headers for sending the file. */
        header('Content-Disposition: inline; filename="' . $fileName . '"');  //Disposition attachment was default, but forces download.
        header('Content-Type: ' . $contentType);
        header('Content-Length: ' . filesize($filePath));
        header('Pragma: no-cache');
        header('Expires: 0');
        
        /* Read the file in ATTACHMENT_BLOCK_SIZE-sized chunks from disk and
         * output to the browser.
         */
        while (!feof($fp))
        {
            print fread($fp, self::ATTACHMENT_BLOCK_SIZE);
        }
        
        fclose($fp);
        
        /* Exit to prevent output after the attachment. */
        exit();
    }
Beispiel #18
0
 public function copyto()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_EDIT)
     {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
         //$this->fatal(ERROR_NO_PERMISSION);
     }
     if($this->_moduleName=="candidates")
     {
         $module = new Candidates($this->_siteID);
     }
     else if($this->_moduleName=="companies")
     {
         $module = new Companies($this->_siteID);
     }
     else if($this->_moduleName=="joborders")
     {
         $module = new JobOrders($this->_siteID);
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!isset($module))
     {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, "Invalid Module: {$this->_moduleName}.");
         return;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('dataItemID', $_GET))
     {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, "Invalid {$this->_moduleName} ID.");
         return;
     }
     /* Update the candidate record. */
     $updateSuccess = $module->copyRecord(
         $_GET['dataItemID'],
         $_GET["siteID"]
     );
     if (!$updateSuccess)
     {
         CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, "Failed to update {$this->_moduleName}.");
     }
     $this->_template->assign('active', $this);
     $this->_template->display('./modules/Settings/copystatus.php');
 }