本文整理汇总了PHP中selector::where方法的典型用法代码示例。如果您正苦于以下问题:PHP selector::where方法的具体用法?PHP selector::where怎么用?PHP selector::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selector
的用法示例。
在下文中一共展示了selector::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orders
public function orders()
{
$this->setDataType("list");
$this->setActionType("view");
if ($this->ifNotXmlMode()) {
return $this->doData();
}
$limit = getRequest('per_page_limit');
$curr_page = (int) getRequest('p');
$offset = $limit * $curr_page;
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('status_id')->isNull(false);
$sel->where('name')->notequals('dummy');
$sel->limit($offset, $limit);
if (!getRequest('order_filter')) {
$sel->order('order_date')->desc();
}
selectorHelper::detectFilters($sel);
$domains = getRequest('domain_id');
if (is_array($domains) && sizeof($domains)) {
$domainsCollection = domainsCollection::getInstance();
if (sizeof($domainsCollection->getList()) > 1) {
$sel->where('domain_id')->equals($domains[0]);
}
}
$this->setDataRange($limit, $offset);
$data = $this->prepareData($sel->result, "objects");
$this->setData($data, $sel->length);
return $this->doData();
}
示例2: merge
/**
* Слить все заказы покупателя в профиль пользователя.
* Объект покупателя после этого будет уничтожен
*/
public function merge(umiObject $customer) {
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals($customer->id);
$sel->where('domain_id')->equals($domainId);
$sel->order('id')->desc();
$permissions = permissionsCollection::getInstance();
$userId = $permissions->getUserId();
foreach($sel as $order) {
if(!$order->status_id) {
$this->mergeBasket($order);
continue;
}
$order->customer_id = $userId;
$order->commit();
}
if (!defined('UMICMS_CLI_MODE') || !UMICMS_CLI_MODE) {
setcookie('customer-id', 0, 1, '/');
}
$customer->delete();
}
示例3: createAuthorGuest
public function createAuthorGuest($nick, $email, $ip)
{
$objects = umiObjectsCollection::getInstance();
$objectTypes = umiObjectTypesCollection::getInstance();
$nick = trim($nick);
$email = trim($email);
if (!$nick) {
$nick = getLabel('author-anonymous');
}
if (!$email) {
$email = getServer('REMOTE_ADDR');
}
$sel = new selector('objects');
$sel->types('object-type')->name('users', 'author');
$sel->where('email')->equals($email);
$sel->where('nickname')->equals($nick);
$sel->where('ip')->equals($ip);
$sel->limit(0, 1);
if ($sel->first) {
return $sel->first->id;
} else {
$user_name = $nick . " ({$email})";
$object_type_id = $objectTypes->getBaseType("users", "author");
$author_id = $objects->addObject($user_name, $object_type_id);
$author = $objects->getObject($author_id);
$author->name = $user_name;
$author->is_registrated = false;
$author->nickname = $nick;
$author->email = $email;
$author->ip = $ip;
$author->commit();
return $author_id;
}
}
示例4: detectWhereFilters
static function detectWhereFilters(selector $v8be74552df93e31bbdd6b36ed74bdb6a)
{
static $v4b5bea44af9baf871f58e4ecb54526ff = array('eq' => 'equals', 'ne' => 'notequals', 'like' => 'like', 'gt' => 'more', 'lt' => 'less');
$va339e2404792d7f8add09a5013066a3e = (array) getRequest('search-all-text');
if (sizeof($v8be74552df93e31bbdd6b36ed74bdb6a->types) == 1 && $v8be74552df93e31bbdd6b36ed74bdb6a->types[0]->objectType instanceof iUmiObjectType && sizeof($v8be74552df93e31bbdd6b36ed74bdb6a->types[0]->objectType->getAllFields()) == 0) {
foreach ($va339e2404792d7f8add09a5013066a3e as $v597a51f04d341eba4ca965899acc10b3) {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('name')->like('%' . $v597a51f04d341eba4ca965899acc10b3 . '%');
}
return;
} else {
foreach ($va339e2404792d7f8add09a5013066a3e as $v597a51f04d341eba4ca965899acc10b3) {
try {
if ($v597a51f04d341eba4ca965899acc10b3 !== "") {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('*')->like('%' . $v597a51f04d341eba4ca965899acc10b3 . '%');
}
} catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
}
}
}
$v2c9885d2b0c7e26971f60a90f33cf718 = (array) getRequest('fields_filter');
foreach ($v2c9885d2b0c7e26971f60a90f33cf718 as $v972bf3f05d14ffbdb817bef60638ff00 => $vcaf9b6b99962bf5c2264824231d7a40c) {
if (is_array($vcaf9b6b99962bf5c2264824231d7a40c)) {
if (isset($vcaf9b6b99962bf5c2264824231d7a40c[0]) && isset($vcaf9b6b99962bf5c2264824231d7a40c[1])) {
try {
$v8be74552df93e31bbdd6b36ed74bdb6a->where($v972bf3f05d14ffbdb817bef60638ff00)->between($vcaf9b6b99962bf5c2264824231d7a40c[0], $vcaf9b6b99962bf5c2264824231d7a40c[1]);
} catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
}
}
foreach ($vcaf9b6b99962bf5c2264824231d7a40c as $v865c0c0b4ab0e063e5caa3387c1a8741 => $v9e3669d19b675bd57058fd4664205d2a) {
if (isset($v4b5bea44af9baf871f58e4ecb54526ff[$v865c0c0b4ab0e063e5caa3387c1a8741])) {
try {
if ($v4b5bea44af9baf871f58e4ecb54526ff[$v865c0c0b4ab0e063e5caa3387c1a8741] == 'like') {
$v9e3669d19b675bd57058fd4664205d2a .= '%';
}
if ($v9e3669d19b675bd57058fd4664205d2a !== "") {
$v8be74552df93e31bbdd6b36ed74bdb6a->where($v972bf3f05d14ffbdb817bef60638ff00)->{$v4b5bea44af9baf871f58e4ecb54526ff}[$v865c0c0b4ab0e063e5caa3387c1a8741]($v9e3669d19b675bd57058fd4664205d2a);
}
} catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
self::tryException($ve1671797c52e15f763380b45e841ec32);
}
}
}
} else {
try {
if ($vcaf9b6b99962bf5c2264824231d7a40c !== "") {
$v8be74552df93e31bbdd6b36ed74bdb6a->where($v972bf3f05d14ffbdb817bef60638ff00)->equals($vcaf9b6b99962bf5c2264824231d7a40c);
}
} catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
}
}
}
}
示例5: export
public function export($v01af57e4ae6d799566f5695b3679756b)
{
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
if (is_array($v01af57e4ae6d799566f5695b3679756b) && count($v01af57e4ae6d799566f5695b3679756b)) {
foreach ($v01af57e4ae6d799566f5695b3679756b as $ve730db5c29b7ba34f4d465b01bd33c5e) {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page($ve730db5c29b7ba34f4d465b01bd33c5e->getId())->childs(100);
}
} else {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(100);
}
$v6a7f245843454cf4f28ad7c5e2572aa2 = array_merge($v8be74552df93e31bbdd6b36ed74bdb6a->result, $v01af57e4ae6d799566f5695b3679756b);
$vbbd738a112791dd1d0cb6bd0d61d878f = $this->getUmiDump($v6a7f245843454cf4f28ad7c5e2572aa2);
return $vbbd738a112791dd1d0cb6bd0d61d878f;
}
示例6: getByCodeName
public static function getByCodeName($code) {
$sel = new selector('objects');
$sel->types('object-type')->name('social_networks','network');
$sel->where('social_id')->equals($code);
return self::get($sel->first);
}
示例7: getAllDiscounts
public function getAllDiscounts($codeName = false)
{
static $discounts = array();
if ($codeName && isset($discounts[$codeName])) {
return $discounts[$codeName];
} elseif (isset($discounts['all'])) {
return $discounts['all'];
}
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'discount');
$sel->where('is_active')->equals(true);
if ($codeName) {
$sel->where('discount_type_id')->equals($this->getDiscountTypeId($codeName));
return $discounts[$codeName] = $sel->result();
}
return $discounts['all'] = $sel->result();
}
示例8: getCustomerOrders
protected function getCustomerOrders()
{
static $customerOrders = null;
if (!is_null($customerOrders)) {
return $customerOrders;
}
$customer = customer::get();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals($customer->id);
$sel->where('domain_id')->equals($domainId);
$sel->where('status_id')->equals(order::getStatusByCode('ready'));
return $customerOrders = $sel->result;
}
示例9: show_user_orders
/**
* Функция рисует список заказов пользователя
* @param string $template Название шаблона
* @return mixed Список заказов пользователя
*/
public function show_user_orders($template = 'default')
{
list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals(customer::get()->id);
$sel->where('name')->isNull(false);
$sel->where('domain_id')->equals($domainId);
if ($sel->length == 0) {
$tpl_block = $tpl_block_empty;
}
$items_arr = array();
foreach ($sel->result as $selOrder) {
$order = order::get($selOrder->id);
$item_arr['attribute:id'] = $order->id;
$item_arr['attribute:name'] = $order->name;
$item_arr['attribute:type-id'] = $order->typeId;
$item_arr['attribute:guid'] = $order->GUID;
$item_arr['attribute:type-guid'] = $order->typeGUID;
$item_arr['attribute:ownerId'] = $order->ownerId;
$item_arr['xlink:href'] = $order->xlink;
$item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
//print_r($order->getValue('order_items'));
//Получаем список товаров заказа
$items = array();
foreach ($order->getItems() as $orderItem) {
// print_r($order_item); die;
$item_line = array();
// print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
$item_line['attribute:element_id'] = $orderItem->id;
$item_line['attribute:name'] = $orderItem->name;
$item_line['attribute:item_amount'] = $orderItem->getAmount();
// $item_line['attribute:options'] = $orderItem->getOptions();
// print_r($order_item->options);
$items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
}
$item_arr['subnodes:order_items'] = $items;
$items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
}
return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
}
示例10: getList
public static function getList($discountTypeId = false)
{
$objectTypeId = self::getRuleType()->getId();
$sel = new selector('objects');
$sel->types('object-type')->id($objectTypeId);
if ($discountTypeId) {
$sel->where('rule_discount_types')->equals($discountTypeId);
}
return $sel->result();
}
示例11: onDispatchChanges
public function onDispatchChanges(iUmiEventPoint $oEvent) {
$sTemplate = "default";
try {
list($sTemplateSubject, $sTemplateMessage) = def_module::loadTemplatesForMail("forum/mails/".$sTemplate, "mail_subject", "mail_message");
} catch (publicException $e) {
return false;
}
$iTopicId = $oEvent->getParam("topic_id");
$iMessageId = $oEvent->getParam("message_id");
$message = umiHierarchy::getInstance()->getElement($iMessageId);
$sel = new selector('objects');
$sel->types('object-type')->name("users", "user");
$sel->where('subscribed_pages')->equals($iTopicId);
if (!$sel->length()) return false;
$hierarchy = umiHierarchy::getInstance();
$block_arr = Array();
$sTemplateSubject = def_module::parseTemplateForMail($sTemplateSubject, $block_arr, $iMessageId);
$sFromEmail = regedit::getInstance()->getVal("//settings/email_from");
$sFromFio = regedit::getInstance()->getVal("//settings/fio_from");
$oMail = new umiMail();
$oMail->setFrom($sFromEmail, $sFromFio);
$oMail->setSubject($sTemplateSubject);
foreach($sel->result() as $oUser) {
$oMailUser = clone $oMail;
$sUserMail = $oUser->getValue('e-mail');
$block_arr['h1'] = $message->getValue('h1');
$block_arr['message'] = $message->getValue('message');
$hierarchy->forceAbsolutePath(true);
$block_arr['unsubscribe_link'] = $hierarchy->getPathById($iTopicId) . "?unsubscribe=" . base64_encode($iUserId);
$sTemplateMessageUser = def_module::parseTemplateForMail($sTemplateMessage, $block_arr, $iMessageId);
$oMailUser->setContent($sTemplateMessageUser);
$hierarchy->forceAbsolutePath(false);
if (umiMail::checkEmail($sUserMail)) {
$sUserFio = $oUser->getValue('lname') . " ". $oUser->getValue('fname') . " " . $oUser->getValue('father_name');
$oMailUser->addRecipient($sUserMail, $sUserFio);
$oMailUser->commit();
$oMailUser->send();
}
else continue;
}
return true;
}
示例12: albums
public function albums($template = "default", $limit = false, $ignore_paging = false, $parentElementId = false, $order = 'asc')
{
list($template_block, $template_block_empty, $template_line) = def_module::loadTemplates("photoalbum/" . $template, "albums_list_block", "albums_list_block_empty", "albums_list_block_line");
$block_arr = array();
$curr_page = (int) getRequest('p');
if ($ignore_paging) {
$curr_page = 0;
}
$offset = $limit * $curr_page;
$sel = new selector('pages');
$sel->types('hierarchy-type')->name('photoalbum', 'album');
$sel->where('permissions');
if ($parentElementId) {
$sel->where('hierarchy')->page($parentElementId)->childs(1);
}
if (in_array($order, array('asc', 'desc', 'rand'))) {
$sel->order('ord')->{$order}();
}
$sel->limit($offset, $limit);
$result = $sel->result;
$total = $sel->length();
$lines = array();
if ($total > 0) {
foreach ($result as $element) {
$line_arr = array();
$element_id = $element->getId();
$line_arr['attribute:id'] = $element_id;
$line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($element_id);
$line_arr['xlink:href'] = "upage://" . $element_id;
$line_arr['node:name'] = $element->getName();
$this->pushEditable("photoalbum", "album", $element_id);
$lines[] = self::parseTemplate($template_line, $line_arr, $element_id);
}
} else {
return self::parseTemplate($template_block_empty, $block_arr);
}
$block_arr['subnodes:items'] = $block_arr['void:lines'] = $lines;
$block_arr['total'] = $total;
$block_arr['per_page'] = $limit;
return self::parseTemplate($template_block, $block_arr);
}
示例13: customContent
function customContent($page, &$vars)
{
$items = new \selector('pages');
$items->types('hierarchy-type')->name('content', 'page');
$items->where('hierarchy')->page($page->id)->childs(1);
$pages = array();
foreach ($items as $item) {
$p = array('id' => $item->id, 'name' => $item->getName(), 'content' => $item->getValue('content'));
$pages[] = $p;
}
$vars['vacancies'] = $pages;
}
示例14: getReleaseMessages
public function getReleaseMessages($iReleaseId = false) {
$iHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "message")->getId();
$iMsgTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iHierarchyTypeId);
$oMsgType = umiObjectTypesCollection::getInstance()->getType($iMsgTypeId);
$sel = new selector('objects');
$sel->types('object-type')->name('dispatches', 'message');
if($iReleaseId) {
$sel->where('release_reference')->equals($iReleaseId);
}
selectorHelper::detectFilters($sel);
return $sel->result;
}
示例15: search_by_size
public function search_by_size()
{
$pages = new selector('objects');
$pages->types('object-type')->name('guide', 'guide');
$pages->where('id')->equals('125');
//$pages->limit(0,3);
$res = '';
foreach ($pages as $page) {
print_r($page);
die;
}
return $res;
}