本文整理汇总了PHP中w2p_Database_Query::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Database_Query::quote方法的具体用法?PHP w2p_Database_Query::quote怎么用?PHP w2p_Database_Query::quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Database_Query
的用法示例。
在下文中一共展示了w2p_Database_Query::quote方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeRecords
public static function storeRecords($records, $user, $type = HOLIDAY_TYPE_COMPANY_HOLIDAY, $annual = 1, $description = "")
{
global $AppUI;
foreach ($records as $record) {
$startDate = $record['startDate']->getPrevDay()->format('%Y-%m-%d');
$endDate = $record['endDate']->getNextDay()->format('%Y-%m-%d');
$q = new w2p_Database_Query();
$q->addTable("holiday");
$q->addQuery("*");
$where = "( date(holiday_start_date) = '";
$where .= $endDate;
$where .= "' OR date(holiday_end_date) = '";
$where .= $startDate;
$where .= "' )";
$where .= " AND holiday_user=" . $user;
$where .= " AND holiday_type=" . $type;
$where .= " AND holiday_annual=" . $annual;
$where .= " AND holiday_description=" . $q->quote($description);
$q->addWhere($where);
$q->addOrder('holiday_start_date');
$list = $q->loadList();
$obj = new CHoliday();
switch (sizeof($list)) {
case 0:
if (!$obj->bind($record)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
break;
case 1:
$item = $list[0];
$obj->load($item['holiday_id']);
if (substr($item['holiday_start_date'], 0, 10) == $endDate) {
$obj->holiday_start_date = $record['endDate']->getDate();
} else {
$obj->holiday_end_date = $record['startDate']->getDate();
}
break;
case 2:
$item1 = $list[0];
$item2 = $list[1];
if (substr($item1['holiday_end_date'], 0, 10) != $startDate || substr($item2['holiday_start_date'], 0, 10) != $endDate) {
$AppUI->setMsg($AppUI->_('User holidays inconsistency'), UI_MSG_ERROR);
$AppUI->redirect();
}
$obj2 = new CHoliday();
$obj2->load($item2['holiday_id']);
$result = $obj2->delete($AppUI);
if (is_string($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR);
$AppUI->redirect();
}
$obj->load($item1['holiday_id']);
$obj->holiday_end_date = $item2['holiday_end_date'];
break;
default:
$AppUI->setMsg($AppUI->_('User holidays inconsistency'), UI_MSG_ERROR);
$AppUI->redirect();
}
$result = $obj->store($AppUI);
if (is_string($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR);
$AppUI->redirect();
}
}
}
示例2: w2PgetUsersHashList
function w2PgetUsersHashList($stub = null, $where = null, $orderby = 'contact_first_name, contact_last_name')
{
global $AppUI;
$q = new w2p_Database_Query();
$q->addTable('users');
$q->addQuery('DISTINCT(user_id), user_username, contact_last_name, contact_first_name,
company_name, contact_company, dept_id, dept_name, CONCAT(contact_first_name,\' \',contact_last_name) contact_name, user_type');
$q->addJoin('contacts', 'con', 'con.contact_id = user_contact', 'inner');
if ($stub) {
$q->addWhere('(UPPER(user_username) LIKE \'' . $stub . '%\' or UPPER(contact_first_name) LIKE \'' . $stub . '%\' OR UPPER(contact_last_name) LIKE \'' . $stub . '%\')');
} elseif ($where) {
$where = $q->quote('%' . $where . '%');
$q->addWhere('(UPPER(user_username) LIKE ' . $where . ' OR UPPER(contact_first_name) LIKE ' . $where . ' OR UPPER(contact_last_name) LIKE ' . $where . ')');
}
$q->addQuery('contact_email');
$q->addGroup('user_id');
$q->addOrder($orderby);
// get CCompany() to filter by company
$obj = new CCompany();
$companies = $obj->getAllowedSQL($AppUI->user_id, 'company_id');
$q->addJoin('companies', 'com', 'company_id = contact_company');
if ($companies) {
$q->addWhere('(' . implode(' OR ', $companies) . ' OR contact_company=\'\' OR contact_company IS NULL OR contact_company = 0)');
}
$dpt = new CDepartment();
$depts = $dpt->getAllowedSQL($AppUI->user_id, 'dept_id');
$q->addJoin('departments', 'dep', 'dept_id = contact_department');
if ($depts) {
$q->addWhere('(' . implode(' OR ', $depts) . ' OR contact_department=0)');
}
return $q->loadHashList('user_id');
}