本文整理汇总了PHP中Hooks::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Hooks::get方法的具体用法?PHP Hooks::get怎么用?PHP Hooks::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hooks
的用法示例。
在下文中一共展示了Hooks::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTaskError
public static function setTaskError($taskID, $errorCode = 1)
{
$db = DatabaseConnection::getInstance();
$sql = sprintf("UPDATE\n queue\n SET\n error = %s\n WHERE\n queue_id = %s", $db->makeQueryInteger($errorCode), $db->makeQueryInteger($taskID));
$rs = $db->query($sql);
if ($errorCode == 1) {
if (!eval(Hooks::get('QUEUEERROR_NOTIFY_DEV'))) {
return;
}
}
return $rs;
}
示例2: getAttachment
private 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;
}
示例3: add
/**
* Adds a candidate to the pipeline for a job order.
*
* @param integer job order ID
* @param integer candidate ID
* @return true on success; false otherwise.
*/
public function add($candidateID, $jobOrderID, $userID = 0)
{
$sql = sprintf("SELECT\n COUNT(candidate_id) AS candidateIDCount\n FROM\n candidate_joborder\n WHERE\n candidate_id = %s\n AND\n joborder_id = %s\n AND\n site_id = %s", $this->_db->makeQueryInteger($candidateID), $this->_db->makeQueryInteger($jobOrderID), $this->_siteID);
$rs = $this->_db->getAssoc($sql);
if (empty($rs)) {
return false;
}
$count = $rs['candidateIDCount'];
if ($count > 0) {
/* Candidate already exists in the pipeline. */
return false;
}
$extraFields = '';
$extraValues = '';
if (!eval(Hooks::get('PIPELINES_ADD_SQL'))) {
return;
}
$sql = sprintf("INSERT INTO candidate_joborder (\n site_id,\n joborder_id,\n candidate_id,\n status,\n added_by,\n date_created,\n date_modified%s\n )\n VALUES (\n %s,\n %s,\n %s,\n 100,\n %s,\n NOW(),\n NOW()%s\n )", $extraFields, $this->_siteID, $this->_db->makeQueryInteger($jobOrderID), $this->_db->makeQueryInteger($candidateID), $this->_db->makeQueryInteger($userID), $extraValues);
$queryResult = $this->_db->query($sql);
if (!$queryResult) {
return false;
}
return true;
}
示例4: displayPublicJobOrders
private function displayPublicJobOrders()
{
$site = new Site(-1);
$careerPortalSiteID = $site->getFirstSiteID();
if (!eval(Hooks::get('RSS_SITEID'))) {
return;
}
$jobOrders = new JobOrders($careerPortalSiteID);
$rs = $jobOrders->getAll(JOBORDERS_STATUS_ACTIVE, -1, -1, -1, false, true);
/* XML Headers */
header('Content-type: text/xml');
$indexName = CATSUtility::getIndexName();
$stream = sprintf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<rss version=\"2.0\">\n" . "<channel>\n" . "<title>New Job Orders</title>\n" . "<description>CATS RSS Feed</description>\n" . "<link>%s</link>\n" . "<pubDate>%s</pubDate>\n", CATSUtility::getAbsoluteURI(), DateUtility::getRSSDate());
foreach ($rs as $rowIndex => $row) {
$uri = sprintf("%scareers/?p=showJob&ID=%d", CATSUtility::getAbsoluteURI(), $row['jobOrderID']);
// Fix URL if viewing from /rss without using globals or dirup '../'
if (strpos($_SERVER['PHP_SELF'], '/rss/') !== false) {
$uri = str_replace('/rss/', '/', $uri);
}
$stream .= sprintf("<item>\n" . "<title>%s (%s)</title>\n" . "<description>Located in %s.</description>\n" . "<link>%s</link>\n" . "</item>\n", $row['title'], $jobOrders->typeCodeToString($row['type']), StringUtility::makeCityStateString($row['city'], $row['state']), $uri);
}
$stream .= "</channel>\n</rss>\n";
echo $stream;
}
示例5: wizard_website
public function wizard_website()
{
if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
echo 'CATS has lost your session!';
return;
}
$website = trim(isset($_GET[$id = 'website']) ? $_GET[$id] : '');
if (strlen($website) > 10) {
if (!eval(Hooks::get('SETTINGS_CP_REQUEST'))) {
return;
}
}
echo 'Ok';
}
示例6: printFooter
/**
* Prints footer HTML for non-report pages.
*
* @return void
*/
public static function printFooter()
{
$build = $_SESSION['CATS']->getCachedBuild();
$loadTime = $_SESSION['CATS']->getExecutionTime();
if ($build > 0) {
$buildString = ' build ' . $build;
} else {
$buildString = '';
}
/* THE MODIFICATION OF THE COPYRIGHT AND 'Powered by CATS' LINES IS NOT ALLOWED
BY THE TERMS OF THE CPL FOR CATS OPEN SOURCE EDITION.
II) The following copyright notice must be retained and clearly legible
at the bottom of every rendered HTML document: Copyright (C) 2005 - 2007
Cognizo Technologies, Inc. All rights reserved.
III) The "Powered by CATS" text or logo must be retained and clearly
legible on every rendered HTML document. The logo, or the text
"CATS", must be a hyperlink to the CATS Project website, currently
http://www.catsone.com/.
*/
echo '<div class="footerBlock">', "\n";
echo '<p id="footerText">CATS Version ', CATS_VERSION, $buildString, '. <span id="toolbarVersion"></span>Powered by <a href="http://www.catsone.com/"><strong>CATS</strong></a>.</p>', "\n";
echo '<span id="footerResponse">Server Response Time: ', $loadTime, ' seconds.</span><br />';
echo '<span id="footerCopyright">', COPYRIGHT_HTML, '</span>', "\n";
if (!eval(Hooks::get('TEMPLATEUTILITY_SHOWPRIVACYPOLICY'))) {
return;
}
echo '</div>', "\n";
eval(Hooks::get('TEMPLATE_UTILITY_PRINT_FOOTER'));
echo '</body>', "\n";
echo '</html>', "\n";
if ((!file_exists('modules/asp') || defined('CATS_TEST_MODE') && CATS_TEST_MODE) && LicenseUtility::isProfessional() && !rand(0, 10)) {
if (!LicenseUtility::validateProfessionalKey(LICENSE_KEY)) {
CATSUtility::changeConfigSetting('LICENSE_KEY', "''");
}
}
}
示例7:
echo $delimiter, 'asc', $delimiter;
} else {
echo $delimiter, 'desc', $delimiter;
}
} else {
echo $delimiter, 'asc', $delimiter;
}
} else {
if ($sortDirection == 'desc' || $sortDirection == '') {
echo $delimiter, 'desc', $delimiter;
} else {
echo $delimiter, 'asc', $delimiter;
}
}
}
if (!eval(Hooks::get('JO_AJAX_GET_PIPELINE'))) {
return;
}
?>
<?php
echo TemplateUtility::getRatingsArrayJS();
?>
<script type="text/javascript">
PipelineJobOrder_setLimitDefaultVars('<?php
echo $sortBy;
?>
', '<?php
echo $sortDirection;
?>
示例8: array
<?php
//trace("======");
/*
* CandidATS
* Sites Management
*
* Copyright (C) 2014 - 2015 Auieo Software Private Limited, Parent Company of Unicomtech.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ob_start();
if ($this->isPopup)
{
TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
else
{
TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
$AUIEO_HEADER= ob_get_clean();
$AUIEO_CONTENT="";
ob_start();
if ($this->data['is_admin_hidden'] == 1)
{
?>
<p class="warning">This Candidate is hidden. Only CATS Administrators can view it or search for it. To make it visible by the site users, click <a href="<?php echo(CATSUtility::getIndexName()); ?>?m=candidates&a=administrativeHideShow&candidateID=<?php echo($this->candidateID); ?>&state=0" style="font-weight:bold;">Here.</a></p>
<?php
示例9: submitXMLFeeds
/**
* Submits all applicable job feeds in all available formats to the
* asynchronous queue processor which begins submitting them to the
* appropriate websites.
*
* @param int ID of the site to submit
*/
public static function submitXMLFeeds($siteID)
{
if (!eval(Hooks::get('XML_SUBMIT_FEEDS_TO_QUEUE'))) {
return;
}
}
示例10: onDeleteAttachment
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);
}
示例11: generateJobOrderReportPDF
public function generateJobOrderReportPDF()
{
/* E_STRICT doesn't like FPDF. */
$errorReporting = error_reporting();
error_reporting($errorReporting & ~ E_STRICT);
include_once('./lib/fpdf/fpdf.php');
error_reporting($errorReporting);
// FIXME: Hook?
$isASP = $_SESSION['CATS']->isASP();
$unixName = $_SESSION['CATS']->getUnixName();
$siteName = $this->getTrimmedInput('siteName', $_GET);
$companyName = $this->getTrimmedInput('companyName', $_GET);
$jobOrderName = $this->getTrimmedInput('jobOrderName', $_GET);
$periodLine = $this->getTrimmedInput('periodLine', $_GET);
$accountManager = $this->getTrimmedInput('accountManager', $_GET);
$recruiter = $this->getTrimmedInput('recruiter', $_GET);
$notes = $this->getTrimmedInput('notes', $_GET);
if (isset($_GET['dataSet']))
{
$dataSet = $_GET['dataSet'];
$dataSet = explode(',', $dataSet);
}
else
{
$dataSet = array(4, 3, 2, 1);
}
/* PDF Font Face. */
// FIXME: Customizable.
$fontFace = 'helvetica';
$pdf=new \TCPDF();
//$pdf = new FPDF();
$pdf->AddPage();
if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) return;
$pdf->SetFont($fontFace, 'B', 10);
if ($isASP && $unixName == 'cognizo')
{
/* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */
$pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20);
$pdf->SetXY(129,27);
$pdf->Write(5, 'Information Technology Consulting');
}
$pdf->SetXY(25, 35);
$pdf->SetFont($fontFace, 'BU', 14);
$pdf->Write(5, "Recruiting Summary Report\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n");
$pdf->SetFont($fontFace, 'B', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Company: '. $companyName . "\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Period: ' . $periodLine . "\n\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Account Manager: ' . $accountManager . "\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Recruiter: ' . $recruiter . "\n");
/* Note that the server is not logged in when getting this file from
* itself.
*/
// FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
// really don't like this... There has to be a way.
// FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
// in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
$URI = CATSUtility::getAbsoluteURI(
CATSUtility::getIndexName()
. '?m=graphs&a=jobOrderReportGraph&data='
. urlencode(implode(',', $dataSet))
);
$pdf->Image($URI, 70, 95, 80, 80, 'jpg');
$pdf->SetXY(25,180);
$pdf->SetFont($fontFace, '', 10);
$pdf->Write(5, 'Total Candidates ');
$pdf->SetTextColor(255, 0, 0);
$pdf->Write(5, 'Screened');
$pdf->SetTextColor(0, 0, 0);
$pdf->Write(5, ' by ' . $siteName . ": \n\n");
//.........这里部分代码省略.........
示例12: transparentLogin
/**
* Forces the session to make the current user "transparently" login to
* another site. This is used only to support the CATS administrative
* console, but must remain part of Session.
*
* @param integer New Site ID to login to.
* @param integer User ID with which to login to the new site.
* @param integer Site ID associated with $asUserID
* @return void
*/
public function transparentLogin($toSiteID, $asUserID, $asSiteID)
{
$db = DatabaseConnection::getInstance();
$sql = sprintf("SELECT\n user.user_id AS userID,\n user.user_name AS username,\n user.first_name AS firstName,\n user.last_name AS lastName,\n user.access_level AS accessLevel,\n user.site_id AS userSiteID,\n user.is_demo AS isDemoUser,\n user.email AS email,\n user.categories AS categories,\n site.name AS siteName,\n site.unix_name AS unixName,\n site.company_id AS companyID,\n site.is_demo AS isDemo,\n site.account_active AS accountActive,\n site.account_deleted AS accountDeleted,\n site.time_zone AS timeZone,\n site.date_format_ddmmyy AS dateFormatDMY,\n site.is_free AS isFree,\n site.is_hr_mode AS isHrMode\n FROM\n user\n LEFT JOIN site\n ON site.site_id = %s\n WHERE\n user.user_id = %s\n AND user.site_id = %s", $toSiteID, $asUserID, $asSiteID);
$rs = $db->getAssoc($sql);
$this->_username = $rs['username'];
$this->_userID = $rs['userID'];
$this->_siteID = $toSiteID;
$this->_firstName = $rs['firstName'];
$this->_lastName = $rs['lastName'];
$this->_siteName = $rs['siteName'];
$this->_unixName = $rs['unixName'];
$this->_accessLevel = $rs['accessLevel'];
$this->_realAccessLevel = $rs['accessLevel'];
$this->_categories = array();
$this->_isASP = $rs['companyID'] != 0 ? true : false;
$this->_siteCompanyID = $rs['companyID'] != 0 ? $rs['companyID'] : -1;
$this->_isFree = $rs['isFree'] == 0 ? false : true;
$this->_isHrMode = $rs['isHrMode'] != 0 ? true : false;
$this->_accountActive = $rs['accountActive'] == 0 ? false : true;
$this->_accountDeleted = $rs['accountDeleted'] == 0 ? false : true;
$this->_email = $rs['email'];
$this->_timeZone = $rs['timeZone'];
$this->_dateDMY = $rs['dateFormatDMY'] == 0 ? false : true;
$this->_isFirstTimeSetup = true;
$this->_isAgreedToLicense = true;
$this->_isLocalizationConfigured = true;
/* Mark session as logged in. */
$this->_isLoggedIn = true;
/* Force a new MRU object to be created. */
$this->_MRU = null;
if (!eval(Hooks::get('TRANSPARENT_LOGIN_POST'))) {
return;
}
$cookie = $this->getCookie();
$sql = sprintf("UPDATE\n user\n SET\n session_cookie = %s\n WHERE\n user_id = %s\n AND\n site_id = %s", $db->makeQueryString($cookie), $asUserID, $asSiteID);
$db->query($sql);
}
示例13: __construct
public function __construct($siteID, $parameters, $misc)
{
/* Pager configuration. */
$this->_tableWidth = 915;
$this->_defaultAlphabeticalSortBy = 'title';
$this->ajaxMode = false;
$this->showExportCheckboxes = true;
//BOXES WILL NOT APPEAR UNLESS SQL ROW exportID IS RETURNED!
$this->showActionArea = true;
$this->showChooseColumnsBox = true;
$this->allowResizing = true;
$this->defaultSortBy = 'dateCreatedSort';
$this->defaultSortDirection = 'DESC';
$this->_defaultColumns = array(array('name' => 'Attachments', 'width' => 10), array('name' => 'ID', 'width' => 26), array('name' => 'Title', 'width' => 170), array('name' => 'Company', 'width' => 135), array('name' => 'Type', 'width' => 30), array('name' => 'Status', 'width' => 40), array('name' => 'Created', 'width' => 55), array('name' => 'Age', 'width' => 30), array('name' => 'Submitted', 'width' => 18), array('name' => 'Pipeline', 'width' => 18), array('name' => 'Recruiter', 'width' => 65), array('name' => 'Owner', 'width' => 55));
if (!eval(Hooks::get('JOBORDERS_DATAGRID_DEFAULTS'))) {
return;
}
parent::__construct("joborders:joborderSavedListByViewDataGrid", $siteID, $parameters, $misc);
}
示例14: newSubmissions
private function newSubmissions()
{
/* Grab an instance of Statistics. */
$statistics = new Statistics($this->_siteID);
$RS = $statistics->getSubmissionsByPeriod(TIME_PERIOD_LASTTWOWEEKS);
// FIXME: Factor out these calculations? Common to most of these graphs.
$firstDay = mktime(0, 0, 0, DateUtility::getAdjustedDate('m'), DateUtility::getAdjustedDate('d') - DateUtility::getAdjustedDate('w') - 7, DateUtility::getAdjustedDate('Y'));
$y = array();
for ($i = 0; $i < 14; $i++) {
$thisDay = mktime(0, 0, 0, date('m', $firstDay), date('d', $firstDay) + $i, date('Y', $firstDay));
$y[] = date('d', $thisDay);
}
/* Get values. */
$x = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
foreach ($RS as $lineRS) {
$thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
$dayOfWeek = (int) date('w', $thisDay);
if (DateUtility::getWeekNumber($thisDay) != DateUtility::getWeekNumber()) {
$x[$dayOfWeek]++;
} else {
$x[$dayOfWeek + 7]++;
}
}
$graph = new GraphSimple($y, $x, 'Orange', 'New Submissions', $this->width, $this->height);
if (!eval(Hooks::get('GRAPH_NEW_SUBMISSIONS'))) {
return;
}
$graph->draw();
die;
}
示例15: onExport
/**
* 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;
}