本文整理汇总了PHP中DBQuery::arrayToIn方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::arrayToIn方法的具体用法?PHP DBQuery::arrayToIn怎么用?PHP DBQuery::arrayToIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBQuery
的用法示例。
在下文中一共展示了DBQuery::arrayToIn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initQuery
function initQuery($params)
{
$tables = Subscriptions::getTables();
$ttable = 'subscription_topic';
$tcolumns =& $tables[$ttable]['columns'];
$etable = 'subscription_email';
$ecolumns =& $tables[$etable]['columns'];
$atable = 'email_address';
$acolumns =& $tables[$atable]['columns'];
$this->addSelectTable($ttable);
$this->addSelectField($acolumns['email_id']);
$this->addSelectField($acolumns['email']);
$this->addSelectField($ecolumns['topic_id']);
$this->SelectGroup($ecolumns['email_id']);
$this->SelectGroup($ecolumns['topic_id']);
$this->addInnerJoin($etable, $ecolumns['topic_id'], DB_EQ, $tcolumns['topic_id']);
if (isset($params['email_id'])) {
$this->WhereValue($ecolumns['email_id'], DB_EQ, $email);
} else {
$this->addInnerJoin($atable, $acolumns['email_id'], DB_EQ, $ecolumns['email_id']);
$this->Where($acolumns['email'], DB_IN, DBQuery::arrayToIn($params['emails']));
}
if (isset($params['signed_in'])) {
$this->WhereAND();
$access = array(SUBSCRIPTION_TOPIC_FULL_ACCESS, $params['signed_in'] ? SUBSCRIPTION_TOPIC_REGISTERED_ONLY : SUBSCRIPTION_TOPIC_GUEST_ONLY);
$this->Where($tcolumns['topic_access'], DB_IN, DBQuery::arrayToIn($access));
}
if (!empty($params['active_only'])) {
$this->WhereAND();
$this->WhereValue($tcolumns['topic_status'], DB_EQ, SUBSCRIPTION_TOPIC_ACTIVE);
}
}
示例2: getTopicsEmailsCount
function getTopicsEmailsCount($topics_ids, $unique = true)
{
global $application;
if (empty($topics_ids)) {
return array();
}
$tables = $this->getTables();
$etable = 'subscription_email';
$ecolumns =& $tables[$etable]['columns'];
$query = new DB_Select($etable);
if ($unique) {
$query->addSelectField(DB_Select::fCountDistinct($ecolumns['email_id']), 'email_count');
} else {
$query->addSelectField(DB_Select::fCount($ecolumns['email_id']), 'email_count');
}
$query->Where($ecolumns['topic_id'], DB_IN, DBQuery::arrayToIn($topics_ids));
$res = $application->db->getDB_Result($query);
return $res[0]['email_count'];
}
示例3: createUnsubscribeKeys
function createUnsubscribeKeys($letter_id, $delivery_num, $topics_ids)
{
global $application;
$str_topics_ids = implode(',', $topics_ids);
// copy emails to unsubscribe table
$ntables = $this->getTables();
$stables = modApiFunc('Subscriptions', 'getTables');
$utable = 'newsletter_unsubscribe';
$ucolumns = $ntables[$utable]['columns'];
$ltable = 'newsletter_topics';
$lcolumns = $ntables[$ltable]['columns'];
$etable = 'subscription_email';
$ecolumns = $stables[$etable]['columns'];
$atable = 'email_address';
$acolumns = $stables[$atable]['columns'];
$iquery = new DB_Insert_Select($utable);
$iquery->setModifiers(DB_IGNORE);
$iquery->setInsertFields(array('key_unsubscribe', 'delivery_num', 'letter_id', 'email_id', 'topics_ids'));
$squery = new DB_Select($etable);
$squery->addSelectField('MD5(CONCAT("' . $delivery_num . '", "' . $letter_id . '", "' . $str_topics_ids . '", NOW(), ' . $ecolumns['email_id'] . ', ' . $acolumns['email'] . '))');
$squery->addSelectField($delivery_num . '-0', 'delivery_num');
$squery->addSelectField($letter_id . '+0', 'letter_id');
$squery->addSelectField($ecolumns['email_id']);
$squery->addSelectField(DBQuery::quoteValue($str_topics_ids));
$squery->addInnerJoin($atable, $ecolumns['email_id'], DB_EQ, $acolumns['email_id']);
$squery->Where($ecolumns['topic_id'], DB_IN, DBQuery::arrayToIn($topics_ids));
$squery->SelectGroup($ecolumns['email_id']);
$squery->SelectOrder($ecolumns['email_id'], 'ASC');
$iquery->setSelectQuery($squery);
$application->db->getDB_Result($iquery);
$this->_totalRecipients = $this->countTempEmails($delivery_num);
$this->_sentCountTotal = 0;
$result = array('Errors' => array($application->db->_getSQL($iquery)), 'Warnings' => array(), 'TotalCount' => $this->_totalRecipients, 'Num' => $delivery_num);
return $result;
}