本文整理汇总了PHP中DatabaseConnection::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::getInstance方法的具体用法?PHP DatabaseConnection::getInstance怎么用?PHP DatabaseConnection::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($siteID, $parameters)
{
/* Pager configuration. */
$this->_tableWidth = 915;
$this->_defaultAlphabeticalSortBy = 'lastName';
$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->dateCriterion = '';
if (isset($parameters['period']) && !empty($parameters['period'])) {
$this->dateCriterion .= ' AND activity.date_created >= ' . $parameters['period'] . ' ';
} else {
if (isset($parameters['startDate']) && !empty($parameters['startDate'])) {
$this->dateCriterion .= ' AND activity.date_created >= \'' . $parameters['startDate'] . '\' ';
}
if (isset($parameters['endDate']) && !empty($parameters['endDate'])) {
$this->dateCriterion .= ' AND activity.date_created <= \'' . $parameters['endDate'] . '\' ';
}
}
$this->defaultSortBy = 'dateCreatedSort';
$this->defaultSortDirection = 'DESC';
$this->_defaultColumns = array(array('name' => 'Date', 'width' => 110), array('name' => 'First Name', 'width' => 85), array('name' => 'Last Name', 'width' => 75), array('name' => 'Regarding', 'width' => 125), array('name' => 'Activity', 'width' => 65), array('name' => 'Notes', 'width' => 240), array('name' => 'Entered By', 'width' => 60));
$this->_db = DatabaseConnection::getInstance();
$this->_siteID = $siteID;
$this->_assignedCriterion = "";
$this->_dataItemIDColumn = 'company.company_id';
$this->_classColumns = array('Date' => array('pagerRender' => 'return $rsData[\'dateCreated\'];', 'sortableColumn' => 'dateCreatedSort', 'pagerWidth' => 110, 'pagerOptional' => true, 'alphaNavigation' => true, 'filterHaving' => 'dateCreated'), 'First Name' => array('pagerRender' => 'if ($rsData[\'dataItemType\']==' . DATA_ITEM_CANDIDATE . ') {$ret = \'<img src="images/mru/candidate.gif" height="12" alt="" />\';} else if ($rsData[\'dataItemType\']==' . DATA_ITEM_CONTACT . ') {$ret = \'<img src="images/mru/contact.gif" height="12">\';} else {$ret = \'<img src="images/mru/blank.gif">\';} if ($rsData[\'isHot\'] == 1) $className = \'jobLinkHot\'; else $className = \'jobLinkCold\'; if ($rsData[\'dataItemType\']==' . DATA_ITEM_CANDIDATE . ') {return $ret.\' <a href="' . CATSUtility::getIndexName() . '?m=candidates&a=show&candidateID=\'.$rsData[\'dataItemID\'].\'" class="\'.$className.\'" title="\'.htmlspecialchars(InfoString::make($rsData[\'dataItemType\'],$rsData[\'dataItemID\'],$rsData[\'siteID\'])).\'">\'.htmlspecialchars($rsData[\'firstName\']).\'</a>\';} else {return $ret.\' <a href="' . CATSUtility::getIndexName() . '?m=contacts&a=show&contactID=\'.$rsData[\'dataItemID\'].\'" class="\'.$className.\'" title="\'.htmlspecialchars(InfoString::make($rsData[\'dataItemType\'],$rsData[\'dataItemID\'],$rsData[\'siteID\'])).\'">\'.htmlspecialchars($rsData[\'firstName\']).\'</a>\';}', 'sortableColumn' => 'firstName', 'pagerWidth' => 85, 'pagerOptional' => false, 'alphaNavigation' => true, 'filterHaving' => 'firstName'), 'Last Name' => array('pagerRender' => 'if ($rsData[\'isHot\'] == 1) $className = \'jobLinkHot\'; else $className = \'jobLinkCold\'; if ($rsData[\'dataItemType\']==' . DATA_ITEM_CANDIDATE . ') {return \'<a href="' . CATSUtility::getIndexName() . '?m=candidates&a=show&candidateID=\'.$rsData[\'dataItemID\'].\'" class="\'.$className.\'" title="\'.htmlspecialchars(InfoString::make($rsData[\'dataItemType\'],$rsData[\'dataItemID\'],$rsData[\'siteID\'])).\'"> \'.htmlspecialchars($rsData[\'lastName\']).\'</a>\';} else {return \'<a href="' . CATSUtility::getIndexName() . '?m=contacts&a=show&contactID=\'.$rsData[\'dataItemID\'].\'" class="\'.$className.\'" title="\'.htmlspecialchars(InfoString::make($rsData[\'dataItemType\'],$rsData[\'dataItemID\'],$rsData[\'siteID\'])).\'"> \'.htmlspecialchars($rsData[\'lastName\']).\'</a>\';}', 'sortableColumn' => 'lastName', 'pagerWidth' => 75, 'pagerOptional' => false, 'alphaNavigation' => true, 'filterHaving' => 'lastName'), 'Regarding' => array('pagerRender' => 'if ($rsData[\'jobIsHot\'] == 1) $className = \'jobLinkHot\'; else $className = \'jobLinkCold\'; if ($rsData[\'companyIsHot\'] == 1) $companyClassName = \'jobLinkHot\'; else $companyClassName = \'jobLinkCold\'; if ($rsData[\'regardingJobTitle\'] == \'\') {$ret = \'General\'; } else {$ret = \'<a href="' . CATSUtility::getIndexName() . '?m=joborders&a=show&jobOrderID=\'.$rsData[\'jobOrderID\'].\'" class="\'.$className.\'">\'.htmlspecialchars($rsData[\'regardingJobTitle\']).\'</a>\'; if($rsData[\'regardingCompanyName\'] != \'\') {$ret .= \' <a href="' . CATSUtility::getIndexName() . '?m=companies&a=show&companyID=\'.$rsData[\'companyID\'].\'" class="\'.$companyClassName.\'">(\'.htmlspecialchars($rsData[\'regardingCompanyName\']).\')\';}} return $ret;', 'sortableColumn' => 'regarding', 'pagerWidth' => 125, 'pagerOptional' => true, 'alphaNavigation' => true, 'filterHaving' => 'regarding'), 'Activity' => array('pagerRender' => '$ret = $rsData[\'typeDescription\']; return $ret;', 'sortableColumn' => 'typeDescription', 'pagerWidth' => 65, 'pagerOptional' => true, 'alphaNavigation' => true, 'filter' => 'activity_type.short_description'), 'Notes' => array('pagerRender' => 'return $rsData[\'notes\'];', 'sortableColumn' => 'notes', 'pagerWidth' => 240, 'pagerOptional' => true, 'alphaNavigation' => true, 'filterHaving' => 'notes'), 'Entered By' => array('pagerRender' => 'return StringUtility::makeInitialName($rsData[\'enteredByFirstName\'], $rsData[\'enteredByLastName\'], false, LAST_NAME_MAXLEN);', 'exportRender' => 'return $rsData[\'enteredByFirstName\'] . " " .$rsData[\'enteredByLastName\'];', 'sortableColumn' => 'enteredBySort', 'pagerWidth' => 60, 'alphaNavigation' => true, 'filter' => 'CONCAT(entered_by_user.last_name, entered_by_user.first_name)'));
parent::__construct("activity:ActivityDataGrid", $parameters);
}
示例2: __construct
public function __construct($siteID, $profileLib, $profilePage)
{
$this->_siteID = $siteID;
$this->_profileLib = $profileLib;
$this->_profilePage = $profilePage;
$this->_db = DatabaseConnection::getInstance();
}
示例3: fCallBack
function fCallBack($fileInfo)
{
$objDatabase = DatabaseConnection::getInstance();
$ext=$fileInfo->getExtension();
if($ext!="ini") return;
$realPath=$fileInfo->getRealPath();
$table=$fileInfo->getBasename(".ini");
if(!$objDatabase->isTableExist($table))
{
$objDatabase->createTable($table);
}
$arrIniField=parse_ini_file($realPath, true);
foreach($arrIniField as $field=>$arrData)
{
if(!$objDatabase->isFieldExist($table,$field))
{
$type=isset($arrData["type"])?$arrData["type"]:"VARCHAR";
if(strtolower($type)=="varchar")
{
$size=isset($arrData["size"])?$arrData["size"]:255;
}
else
{
$size=isset($arrData["size"])?$arrData["size"]:11;
}
$objDatabase->addField($table,$field,$type,$size);
}
}
}
示例4: __construct
public function __construct($siteID = null)
{
if (!is_null($siteID)) {
$this->_siteID = $siteID;
}
$this->_db = DatabaseConnection::getInstance();
}
示例5: __construct
public function __construct($siteID)
{
$this->_siteID = $siteID;
// FIXME: Remove dependency on Session here.
$this->_userID = $_SESSION['CATS']->getUserID();
$this->_db = DatabaseConnection::getInstance();
}
示例6: run
public function run($siteID, $args)
{
Task::setName('CleanExceptions');
Task::setDescription('Clean up the exceptions log.');
$db = DatabaseConnection::getInstance();
$sql = sprintf("DELETE FROM\n exceptions\n WHERE\n DATEDIFF(NOW(), exceptions.date) > %s", EXCEPTIONS_TTL_DAYS);
if (!($rs = $db->query($sql))) {
$message = 'Query "' . $sql . '" failed!';
$ret = TASKRET_ERROR;
} else {
$num = $db->getAffectedRows();
if ($num > 0) {
$message = 'Cleaned up ' . number_format($num, 0) . ' exception logs.';
$ret = TASKRET_SUCCESS;
} else {
// Do not log if nothing was done
$message = 'No logs were cleaned.';
$ret = TASKRET_SUCCESS_NOLOG;
}
}
// Set the response the task wants logged
$this->setResponse($message);
// Return one of the above TASKRET_ constants.
return $ret;
}
示例7: __construct
public function __construct($siteID)
{
$this->_siteID = $siteID;
$this->_db = DatabaseConnection::getInstance();
// FIXME: Session coupling...
$this->_timeZoneOffset = $_SESSION['CATS']->getTimeZoneOffset();
}
示例8: AUIEO_SEND_HOOK_EMAIL
function AUIEO_SEND_HOOK_EMAIL($record)
{
$recruiter = $record["recruiter"];
$sql = "select * from user where user_id='{$recruiter}'";
$db = DatabaseConnection::getInstance();
$arrAssoc = $db->getAllAssoc($sql);
$emailAddress = $arrAssoc[0]["email"];
$site_id = $arrAssoc[0]["site_id"];
if ($emailAddress) {
$obj = new JobOrders($site_id);
$obj->load($record["id"]);
$obj->sendTemplateEMail("My Joborder 2", $emailAddress);
}
$owner = $record["owner"];
$sql = "select * from user where user_id='{$owner}'";
$db = DatabaseConnection::getInstance();
$arrAssoc = $db->getAllAssoc($sql);
$emailAddress = $arrAssoc[0]["email"];
$site_id = $arrAssoc[0]["site_id"];
if ($emailAddress) {
$obj = new JobOrders($site_id);
$obj->load($record["id"]);
$obj->sendTemplateEMail("My Joborder 2", $emailAddress);
}
}
示例9: read_events
function read_events($user_id)
{
DatabaseConnection::getInstance();
$statement = DatabaseConnection::$pdo->prepare("UPDATE events SET unread = 0 WHERE send_to = :to");
$statement->bindValue(':to', $user_id);
$statement->execute();
}
示例10: __construct
public function __construct($siteID, $profileID = false)
{
$this->_siteID = $siteID;
$this->_db = DatabaseConnection::getInstance();
$this->_savedProfileID = $profileID;
$this->_savedProfile = false;
$this->_titleCache = false;
}
示例11: update_profile
function update_profile($char_id, $new_profile)
{
DatabaseConnection::getInstance();
$statement = DatabaseConnection::$pdo->prepare('UPDATE players SET messages = :profile WHERE player_id = :char_id');
$statement->bindValue(':profile', $new_profile);
$statement->bindValue(':char_id', $char_id);
$statement->execute();
return true;
}
示例12: update_last_attack_time
/**
* Attack function library.
* @package combat
* @subpackage lib_attack
**/
function update_last_attack_time($player_id)
{
DatabaseConnection::getInstance();
$update_last_attacked = "UPDATE players SET last_started_attack = now() WHERE player_id = :user";
$statement = DatabaseConnection::$pdo->prepare($update_last_attacked);
$statement->bindValue(':user', intval($player_id));
$statement->execute();
// updates the timestamp of the last_attacked column to slow excessive attacks.
}
示例13: check_for_resurrection
function check_for_resurrection($echo = FALSE)
{
DatabaseConnection::getInstance();
$query = DatabaseConnection::$pdo->query("UPDATE players\n SET status = 0,\n health = (CASE WHEN _class_id = 4 THEN (150+(level*3)) ELSE 100 END)\n WHERE active = 1\n AND health < 0\n AND resurrection_time = (SELECT amount from time where time_label='hours')\n AND\n ( days < 31 OR\n \t\t\t\t(\n \t\t\t\t\t((days % cast(floor(days / 10) AS integer)) = 0)\n \t\t\t\t)\n \t\t\t)\n ");
// *** Resurrect and heal all players at this countdown spot.
if ($echo) {
$healedPlayers = $query->rowCount();
echo "Number of healed/resurrected players: " . $healedPlayers;
}
}
示例14: getHTTPLogTypeIDByName
/**
* Returns an HTTP log type ID from a specified type name.
*
* @param string HTTP log type name.
* @return integer HTTP log type ID or -1 if not found.
*/
public static function getHTTPLogTypeIDByName($logTypeName)
{
$db = DatabaseConnection::getInstance();
$sql = sprintf("SELECT\n log_type_id\n FROM\n http_log_types\n WHERE\n (\n name = %s\n OR default_log_type = 1\n )\n ORDER BY\n default_log_type DESC", $db->makeQueryString($logTypeName));
$result = $db->getColumn($sql, 0, 0);
if ($result === false) {
return -1;
}
return $result;
}
示例15: __construct
public function __construct($profileid)
{
$this->id = $profileid;
$objDB = DatabaseConnection::getInstance();
$site_id = $_SESSION["CATS"]->getSiteID();
$sql = "select * from auieo_profiles where id={$profileid} and site_id=" . $_SESSION["CATS"]->getSiteID();
$record = $objDB->getAssoc($sql);
$this->name = $record["profilename"];
$this->objPermission = new PRGPermissions($profileid);
}