当前位置: 首页>>代码示例>>PHP>>正文


PHP w2p_Database_Query::quote方法代码示例

本文整理汇总了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();
         }
     }
 }
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:66,代码来源:holiday_functions.class.php

示例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');
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:32,代码来源:main_functions.php


注:本文中的w2p_Database_Query::quote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。