コード例 #1
0
ファイル: ExportUI.php プロジェクト: Hassanj343/candidats
    /**
     * 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;
    }
コード例 #2
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];
     include_once 'modules/' . $moduleName . '/' . $moduleClass . '.php';
     if (!eval(Hooks::get('LOAD_MODULE'))) {
         return;
     }
     $module = new $moduleClass();
     $module->handleRequest();
 }
コード例 #3
0
ファイル: GraphsUI.php プロジェクト: PublicityPort/OpenCATS
 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;
 }
コード例 #4
0
ファイル: transfer.php プロジェクト: Hassanj343/candidats
        $AUIEO_MODULE = "contacts";
        $record=$dataItem->get($dataItemID);
        /* Bail out if record not found. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID for the Site '.$siteID);
            return;
        }
        $AUIEO_NAME = $record["firstName"]." ".$record["lastName"];
        break;

    default:
        /* Bail out if record not found. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item type.');
            return;
        }
}
ob_start();
if (!empty($this->rs))
{
    foreach ($this->rs as $rowNumber => $data)
    { ?>
    <tr class="<?php TemplateUtility::printAlternatingRowClass($rowNumber); ?>">
        <td valign="top" align="left">
                <?php $this->_($data['name']); ?>
        </td>
        <td valign="top" align="left">
            <a href="<?php echo(CATSUtility::getIndexName()); ?>?m=<?php echo $AUIEO_MODULE; ?>&a=transferto&dataItemType=<?php echo $dataItemType; ?>&dataItemID=<?php echo $dataItemID; ?>&siteID=<?php $this->_($data['siteID']); ?>">
                <?php echo "Transfer"; ?>
コード例 #5
0
ファイル: ReportsUI.php プロジェクト: Hassanj343/candidats
    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');
    }
コード例 #6
0
ファイル: HomeUI.php プロジェクト: Hassanj343/candidats
    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');
    }
コード例 #7
0
ファイル: CompaniesUI.php プロジェクト: rankinp/OpenCATS
 private function onDeleteAttachment()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_DELETE) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     /* Bail out if we don't have a valid attachment ID. */
     if (!$this->isRequiredIDValid('attachmentID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid attachment ID.');
     }
     /* Bail out if we don't have a valid joborder ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid company ID.');
     }
     $companyID = $_GET['companyID'];
     $attachmentID = $_GET['attachmentID'];
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_PRE'))) {
         return;
     }
     $attachments = new Attachments($this->_siteID);
     $attachments->delete($attachmentID);
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_POST'))) {
         return;
     }
     CATSUtility::transferRelativeURI('m=companies&a=show&companyID=' . $companyID);
 }
コード例 #8
0
ファイル: ImportUI.php プロジェクト: PublicityPort/OpenCATS
 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');
 }
コード例 #9
0
ファイル: CareersUI.php プロジェクト: Hassanj343/candidats
    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
                );
            }
        }
    }
コード例 #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);
 }
コード例 #11
0
ファイル: Attachments.php プロジェクト: Hassanj343/candidats
 public function copyAttachment($dataItemType, $dataItemID, $attachmentID)
 {
     $sql = "select * from attachment where  attachment_id ={$attachmentID}";
     $row = $this->_db->getAssoc($sql);
     $filePath = "attachments/" . $row["directory_name"] . $row["stored_filename"];
     $destination = "attachments/" . $row["directory_name"] . $row["stored_filename"] . "_copy";
     if (!file_exists($destination)) {
         return $this->add($dataItemType, $dataItemID, $row["title"], $row["original_filename"], $row["stored_filename"], $row["content_type"], $row["resume"], $row["text"], $row["profile_image"], $row["directory_name"]);
     } else {
         copy($filePath, $destination);
     }
     $filePath = $destination;
     $title = $row["title"];
     $contentType = $row["content_type"];
     $attachmentCreator = new AttachmentCreator($this->_siteID);
     $attachmentCreator->createFromFile($dataItemType, $dataItemID, $filePath, $title, $contentType, $extractText, $fileExists);
     if ($attachmentCreator->isError()) {
         CommonErrors::fatalModal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
         return;
         //$this->fatalModal($attachmentCreator->getError());
     }
 }
コード例 #12
0
ファイル: ActivityUI.php プロジェクト: Hassanj343/candidats
    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');
    }
コード例 #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');
 }
コード例 #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);
         }
     }
 }
コード例 #15
0
ファイル: ContactsUI.php プロジェクト: Hassanj343/candidats
    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');

            }
        }*/
    }
コード例 #16
0
ファイル: ContactsUI.php プロジェクト: rankinp/OpenCATS
 /**
  * Processes an Add Activity / Schedule Event form and displays
  * contacts/AddActivityScheduleEventModal.tpl. This is factored out
  * for code clarity.
  *
  * @param boolean from joborders module perspective
  * @param integer "regarding" job order ID or -1
  * @param string module directory
  * @return void
  */
 private function _addActivityScheduleEvent($regardingID, $directoryOverride = '')
 {
     /* Module directory override for fatal() calls. */
     if ($directoryOverride != '') {
         $moduleDirectory = $directoryOverride;
     } else {
         $moduleDirectory = $this->_moduleDirectory;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('contactID', $_POST)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_POST['contactID'];
     //if (!eval(Hooks::get('CONTACT_ON_ADD_ACTIVITY_SCHEDULE_EVENT_PRE'))) return;
     if ($this->isChecked('addActivity', $_POST)) {
         /* Bail out if we don't have a valid job order ID. */
         if (!$this->isOptionalIDValid('activityTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid activity type ID.');
         }
         $activityTypeID = $_POST['activityTypeID'];
         $activityNote = $this->getTrimmedInput('activityNote', $_POST);
         $activityNote = htmlspecialchars($activityNote);
         /* Add the activity entry. */
         $activityEntries = new ActivityEntries($this->_siteID);
         $activityID = $activityEntries->add($contactID, DATA_ITEM_CONTACT, $activityTypeID, $activityNote, $this->_userID, $regardingID);
         $activityTypes = $activityEntries->getTypes();
         $activityTypeDescription = ResultSetUtility::getColumnValueByIDValue($activityTypes, 'typeID', $activityTypeID, 'type');
         $activityAdded = true;
     } else {
         $activityAdded = false;
         $activityNote = '';
         $activityTypeDescription = '';
     }
     if ($this->isChecked('scheduleEvent', $_POST)) {
         /* Bail out if we received an invalid date. */
         $trimmedDate = $this->getTrimmedInput('dateAdd', $_POST);
         if (empty($trimmedDate) || !DateUtility::validate('-', $trimmedDate, DATE_FORMAT_MMDDYY)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid date.');
         }
         /* Bail out if we don't have a valid event type. */
         if (!$this->isRequiredIDValid('eventTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid event type ID.');
         }
         /* Bail out if we don't have a valid time format ID. */
         if (!isset($_POST['allDay']) || $_POST['allDay'] != '0' && $_POST['allDay'] != '1') {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid time format ID.');
         }
         $eventTypeID = $_POST['eventTypeID'];
         if ($_POST['allDay'] == 1) {
             $allDay = true;
         } else {
             $allDay = false;
         }
         $publicEntry = $this->isChecked('publicEntry', $_POST);
         $reminderEnabled = $this->isChecked('reminderToggle', $_POST);
         $reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
         $reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
         $duration = -1;
         /* Is this a scheduled event or an all day event? */
         if ($allDay) {
             $date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD);
             $hour = 12;
             $minute = 0;
             $meridiem = 'AM';
         } else {
             /* Bail out if we don't have a valid hour. */
             if (!isset($_POST['hour'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.');
             }
             /* Bail out if we don't have a valid minute. */
             if (!isset($_POST['minute'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.');
             }
             /* Bail out if we don't have a valid meridiem value. */
             if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid meridiem value.');
             }
             $hour = $_POST['hour'];
             $minute = $_POST['minute'];
             $meridiem = $_POST['meridiem'];
             /* Convert formatted time to UNIX timestamp. */
             $time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem));
             /* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
             $date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time));
         }
         $description = $this->getTrimmedInput('description', $_POST);
         $title = $this->getTrimmedInput('title', $_POST);
         /* Bail out if any of the required fields are empty. */
         if (empty($title)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.');
         }
         if ($regardingID > 0) {
             $eventJobOrderID = $regardingID;
         } else {
             $eventJobOrderID = -1;
         }
         $calendar = new Calendar($this->_siteID);
         $eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $contactID, DATA_ITEM_CONTACT, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset());
         if ($eventID <= 0) {
             CommonErrors::fatalModal(COMMONERROR_RECORDERROR, $this, 'Failed to add calendar event.');
         }
         /* Extract the date parts from the specified date. */
         $parsedDate = strtotime($date);
         $formattedDate = date('l, F jS, Y', $parsedDate);
         $calendar = new Calendar($this->_siteID);
         $calendarEventTypes = $calendar->getAllEventTypes();
         $eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description');
         $eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate));
         $eventScheduled = true;
     } else {
         $eventHTML = '<p>No event has been scheduled.</p>';
         $eventScheduled = false;
     }
     if (isset($_GET['onlyScheduleEvent'])) {
         $onlyScheduleEvent = true;
     } else {
         $onlyScheduleEvent = false;
     }
     if (!$activityAdded && !$eventScheduled) {
         $changesMade = false;
     } else {
         $changesMade = true;
     }
     if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) {
         return;
     }
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('regardingID', $regardingID);
     $this->_template->assign('activityAdded', $activityAdded);
     $this->_template->assign('activityDescription', $activityNote);
     $this->_template->assign('activityType', $activityTypeDescription);
     $this->_template->assign('eventScheduled', $eventScheduled);
     $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
     $this->_template->assign('eventHTML', $eventHTML);
     $this->_template->assign('changesMade', $changesMade);
     $this->_template->assign('isFinishedMode', true);
     $this->_template->display('./modules/contacts/AddActivityScheduleEventModal.tpl');
 }
コード例 #17
0
ファイル: ListsUI.php プロジェクト: Hassanj343/candidats
    public function onDeleteStaticList()
    {
        /* Bail out if we don't have a valid type. */
        if (!$this->isRequiredIDValid('savedListID', $_GET))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this);
            return;
        }

        $savedListID = $_GET['savedListID'];

        $savedLists = new SavedLists($this->_siteID);

        /* Write changes. */
        $savedLists->delete($savedListID);


        CATSUtility::transferRelativeURI('m=lists');
    }
コード例 #18
0
ファイル: SettingsUI.php プロジェクト: rankinp/OpenCATS
 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');
 }
コード例 #19
0
ファイル: CalendarUI.php プロジェクト: Hassanj343/candidats
    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));
    }
コード例 #20
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();
    }
コード例 #21
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');
 }