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


PHP umiObjectTypesCollection::getInstance方法代码示例

本文整理汇总了PHP中umiObjectTypesCollection::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP umiObjectTypesCollection::getInstance方法的具体用法?PHP umiObjectTypesCollection::getInstance怎么用?PHP umiObjectTypesCollection::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umiObjectTypesCollection的用法示例。


在下文中一共展示了umiObjectTypesCollection::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 public function process($template = null)
 {
     list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/payment/invoice/" . $template, 'legal_person_block', 'legal_person_item');
     $collection = umiObjectsCollection::getInstance();
     $types = umiObjectTypesCollection::getInstance();
     $typeId = $types->getBaseType("emarket", "legal_person");
     $customer = customer::get();
     $order = $this->order;
     $mode = getRequest('param2');
     if ($mode == 'do') {
         $personId = getRequest('legal-person');
         $isNew = $personId == null || $personId == 'new';
         if ($isNew) {
             $typeId = $types->getBaseType("emarket", "legal_person");
             $personId = $collection->addObject("", $typeId);
             $controller = cmsController::getInstance();
             $data = getRequest('data');
             if ($data && ($dataModule = $controller->getModule("data"))) {
                 $person = $collection->getObject($personId);
                 $person->setName($data['new']['name']);
                 $dataModule->saveEditedObject($personId, $isNew, true);
             }
             if ($collection->getObject($personId) instanceof umiObject) {
                 $customer = customer::get();
                 $customer->legal_persons = array_merge($customer->legal_persons, array($personId));
             }
         }
         $order->legal_person = $personId;
         $order->order();
         $order->payment_document_num = $order->id;
         $result = $this->printInvoice($order);
         $buffer = outputBuffer::current();
         $buffer->charset('utf-8');
         $buffer->contentType('text/html');
         $buffer->clear();
         $buffer->push($result);
         $buffer->end();
         return true;
     } else {
         if ($mode == 'delete') {
             $personId = (int) getRequest('person-id');
             if ($collection->isExists($personId)) {
                 $customer = customer::get();
                 $customer->legal_persons = array_diff($customer->legal_persons, array($personId));
                 $collection->delObject($personId);
             }
         }
     }
     $items = array();
     $persons = $customer->legal_persons;
     if (is_array($persons)) {
         foreach ($persons as $personId) {
             $person = $collection->getObject($personId);
             $item_arr = array('attribute:id' => $personId, 'attribute:name' => $person->name);
             $items[] = def_module::parseTemplate($tpl_item, $item_arr, false, $personId);
         }
     }
     $block_arr = array('attribute:type-id' => $typeId, 'attribute:type_id' => $typeId, 'xlink:href' => 'udata://data/getCreateForm/' . $typeId, 'subnodes:items' => $items);
     return def_module::parseTemplate($tpl_block, $block_arr);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:60,代码来源:invoice.php

示例2: json_delete_group

 public function json_delete_group()
 {
     $group_id = (int) getRequest('param0');
     $type_id = (int) getRequest('param1');
     umiObjectTypesCollection::getInstance()->getType($type_id)->delFieldsGroup($group_id);
     $this->flush("");
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:7,代码来源:__json.php

示例3: onAddTopicToDispatch

 public function onAddTopicToDispatch(iUmiEventPoint $oEvent)
 {
     $iDispatchId = regedit::getInstance()->getVal("//modules/forum/dispatch_id");
     if (!$iDispatchId) {
         return false;
     }
     $dispatches_module = cmsController::getInstance()->getModule('dispatches');
     if (!$dispatches_module) {
         return false;
     }
     $iTopicId = (int) $oEvent->getParam('topic_id');
     $oTopicElement = umiHierarchy::getInstance()->getElement($iTopicId);
     if ($oTopicElement instanceof umiHierarchyElement) {
         $sTitle = (string) getRequest('title');
         $sMessage = (string) getRequest('body');
         $iHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "message")->getId();
         $iMsgTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iHierarchyTypeId);
         $oMsgType = umiObjectTypesCollection::getInstance()->getType($iMsgTypeId);
         $iMsgObjId = umiObjectsCollection::getInstance()->addObject($sTitle, $iMsgTypeId);
         $oMsgObj = umiObjectsCollection::getInstance()->getObject($iMsgObjId);
         if ($oMsgObj instanceof umiObject) {
             $iReleaseId = $dispatches_module->getNewReleaseInstanceId($iDispatchId);
             $oMsgObj->setValue('release_reference', $iReleaseId);
             $oMsgObj->setValue('header', $sTitle);
             $oMsgObj->setValue('body', $sMessage);
             $oMsgObj->commit();
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:34,代码来源:__sysevents.php

示例4: onModifyObject

		public function onModifyObject(iUmiEventPoint $event) {
			static $modifiedCache = array();
			$object = $event->getRef("object");
			$typeId = umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'order');
			if($object->getTypeId() != $typeId) return;
			if($event->getMode() == "before") {
				$data = getRequest("data");
				$id   = $object->getId();
				$newOrderStatus    = getArrayKey($data[$id], 'status_id');
				$newPaymentStatus  = getArrayKey($data[$id], 'payment_status_id');
				$newDeliveryStatus = getArrayKey($data[$id], 'delivery_status_id');
				switch(true) {
				   case ($newOrderStatus != $object->getValue("status_id") ) : $modifiedCache[$object->getId()] = "status_id"; break;
				   case ($newDeliveryStatus != $object->getValue("delivery_status_id")) : $modifiedCache[$object->getId()] = "delivery_status_id"; break;
				   case ($newPaymentStatus != $object->getValue("payment_status_id") ) : $modifiedCache[$object->getId()] = "payment_status_id"; break;				   
				}
			} else {
				if(isset($modifiedCache[$object->getId()])) {
					if ($modifiedCache[$object->getId()] == 'payment_status_id' && $object->getValue("payment_status_id") == order::getStatusByCode('accepted', 'order_payment_status')) {
						self::addBonus($object->getId());
					}
					if ($modifiedCache[$object->getId()] == 'status_id' && ($object->getValue("status_id") == order::getStatusByCode('canceled') || $object->getValue("status_id") == order::getStatusByCode('rejected'))) {
						self::returnBonus($object->getId());
					}
					$this->notifyOrderStatusChange(order::get($object->getId()), $modifiedCache[$object->getId()]);
				}
			}
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:28,代码来源:__events.php

示例5: systemEventsNotify

 public function systemEventsNotify(iUmiEventPoint $event)
 {
     $eventId = $event->getEventId();
     $titleLabel = $titleLabel = 'event-' . $eventId . '-title';
     $contentLabel = 'event-' . $eventId . '-content';
     $title = getLabel($titleLabel, 'common/content/config');
     $content = getLabel($contentLabel, 'common/content/config');
     if ($titleLabel == $title) {
         return;
     }
     if ($element = $event->getRef('element')) {
         $hierarchy = umiHierarchy::getInstance();
         $oldbForce = $hierarchy->forceAbsolutePath(true);
         $params = array('%page-name%' => $element->name, '%page-link%' => $element->link);
         $hierarchy->forceAbsolutePath($oldbForce);
     } else {
         $params = array();
     }
     if ($object = $event->getRef('object')) {
         $params['%object-name%'] = $object->name;
         $objectTypes = umiObjectTypesCollection::getInstance();
         $objectType = $objectTypes->getType($object->getTypeId());
         if ($hierarchyTypeId = $objectType->getHierarchyTypeId()) {
             $hierarchyTypes = umiHierarchyTypesCollection::getInstance();
             $hierarchyType = $hierarchyTypes->getType($hierarchyTypeId);
             $params['%object-type%'] = $hierarchyType->getTitle();
         }
     }
     $title = str_replace(array_keys($params), array_values($params), $title);
     $content = str_replace(array_keys($params), array_values($params), $content);
     $this->dispatchSystemEvent($title, $content);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:32,代码来源:__mess_events.php

示例6: create

 /**
  * Создать новый товар для заказа.
  * Выбор класса осуществляется следующим образом:
  * 1. берется элемент $elementId - товар каталога
  * 2. у него берется значение свойства "item_type_id" ("Тип товара"), которое является справочником
  * 3. у него в свою очередь берется свойство "class_name", по которому определяется необходимый класс
  * Если тип не указан, то используется класс orderItem.
  * @param Integer $elementId
  * @param Integer|Boolean $storeId = false id склада, на котором находится товар
  * @return orderItem товар в заказе (объект класса orderItem или его наследнка)
  */
 public static function create($elementId, $storeId = false)
 {
     $objectTypes = umiObjectTypesCollection::getInstance();
     $objects = umiObjectsCollection::getInstance();
     $emarket = cmsController::getInstance()->getModule('emarket');
     $objectTypeId = $objectTypes->getBaseType('emarket', 'order_item');
     $hierarchy = umiHierarchy::getInstance();
     $objectId = $objects->addObject('', $objectTypeId);
     $object = $objects->getObject($objectId);
     if ($object instanceof iUmiObject == false) {
         throw new coreException("Couldn't load order item object #{$objectId}");
     }
     $element = $hierarchy->getElement($elementId);
     if ($element instanceof iUmiHierarchyElement == false) {
         throw new publicException("Page #{$elementId} not found");
     }
     $price = $emarket->getPrice($element, true);
     $object->item_price = $price;
     $object->item_amount = 0;
     $itemTypeId = self::getItemTypeId($element->getObjectTypeId());
     $object->item_type_id = $itemTypeId;
     $object->item_link = $element;
     $object->name = $element->name;
     return self::get($object->getId());
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:36,代码来源:orderItem.php

示例7: import_subscriber

 public function import_subscriber($email, $fname, $lname)
 {
     if (!$email) {
         return false;
     }
     $oSbsSelection = new umiSelection();
     $oSbsSelection->setObjectTypeFilter();
     $iSbsHierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("dispatches", "subscriber")->getId();
     $iSbsTypeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($iSbsHierarchyTypeId);
     $oSbsType = umiObjectTypesCollection::getInstance()->getType($iSbsTypeId);
     $oSbsSelection->addObjectType($iSbsTypeId);
     $oSbsSelection->setNamesFilter();
     $oSbsSelection->addNameFilterEquals($email);
     $arrSbsSelResults = umiSelectionsParser::runSelection($oSbsSelection);
     if (sizeof($arrSbsSelResults)) {
         list($object_id) = $arrSbsSelResults;
     } else {
         $object_id = umiObjectsCollection::getInstance()->addObject($email, $iSbsTypeId);
     }
     if ($oSubscriber = umiObjectsCollection::getInstance()->getObject($object_id)) {
         $oSubscriber->setName($email);
         $oSubscriber->setValue('fname', $fname);
         $oSubscriber->setValue('lname', $lname);
         $oCurrDate = new umiDate(time());
         $oSubscriber->setValue('subscribe_date', $oCurrDate);
         $oSubscriber->setValue('subscriber_dispatches', $this->getAllDispatches());
         $oSubscriber->commit();
     } else {
         return false;
     }
     return $object_id;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:32,代码来源:__subscribers_import.php

示例8: profile

 public function profile($template = "default", $user_id = false)
 {
     if (!$template) {
         $template = "default";
     }
     list($template_block, $template_bad_user_block) = def_module::loadTemplates("users/profile/" . $template, "profile_block", "bad_user_block");
     $block_arr = array();
     if (!$user_id) {
         $user_id = (int) getRequest('param0');
     }
     if (!$user_id) {
         $permissions = permissionsCollection::getInstance();
         if ($permissions->isAuth()) {
             $user_id = $permissions->getUserId();
         }
     }
     if ($user = selector::get('object')->id($user_id)) {
         $this->validateEntityByTypes($user, array('module' => 'users', 'method' => 'user'));
         $block_arr['xlink:href'] = "uobject://" . $user_id;
         $userTypeId = $user->getTypeId();
         if ($userType = umiObjectTypesCollection::getInstance()->getType($userTypeId)) {
             $userHierarchyTypeId = $userType->getHierarchyTypeId();
             if ($userHierarchyType = umiHierarchyTypesCollection::getInstance()->getType($userHierarchyTypeId)) {
                 if ($userHierarchyType->getName() == "users" && $userHierarchyType->getExt() == "user") {
                     $block_arr['id'] = $user_id;
                     return def_module::parseTemplate($template_block, $block_arr, false, $user_id);
                 }
             }
         }
     } else {
         throw new publicException(getLabel('error-object-does-not-exist', null, $user_id));
     }
     return def_module::parseTemplate($template_bad_user_block, $block_arr);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:34,代码来源:__profile.php

示例9: getList

 /**
  * Gets news with specified type. Uses paging.
  *
  * @param int $type Id of type (rubric)
  * @param int $limit Limit for output
  * @param int $page Current page for calculate offset
  * @return array
  */
 public function getList($type, $limit, $page = 1)
 {
     $config = parse_ini_file("./config/config.ini", true);
     $page -= 1;
     $hierarchyTypeId = umiHierarchyTypesCollection::getInstance()->getTypeByName("news", "item")->getId();
     $objectTypeId = umiObjectTypesCollection::getInstance()->getBaseType("news", "item");
     $objectType = umiObjectTypesCollection::getInstance()->getType($objectTypeId);
     $publishTimeFieldId = $objectType->getFieldId('publish_time');
     $publishToAppFieldId = $objectType->getFieldId('publish_to_app');
     $sel = new umiSelection();
     $sel->addElementType($hierarchyTypeId);
     $sel->addHierarchyFilter($type, 0, true);
     if ($config["umi"]["ignore-publish-flag"] != 1) {
         $sel->addPropertyFilterEqual($publishToAppFieldId, true);
     }
     $sel->setOrderByProperty($publishTimeFieldId, false);
     $sel->addLimit($limit, $page);
     $result = umiSelectionsParser::runSelection($sel);
     $items = array();
     $size = sizeof($result);
     for ($i = 0; $i < $size; $i++) {
         $elementId = $result[$i];
         $element = umiHierarchy::getInstance()->getElement($elementId);
         if (!$element) {
             continue;
         }
         $items[] = array("id" => $elementId, "header" => $element->getValue("h1"), "date" => $element->getValue("publish_time")->getFormattedDate("d.m.Y"), "image" => "http://" . $_SERVER['HTTP_HOST'] . $element->getValue("anons_pic"), "original_link" => "http://" . $_SERVER['HTTP_HOST'] . umiHierarchy::getInstance()->getPathById($elementId));
     }
     return $items;
 }
开发者ID:kei-sidorov,项目名称:yugs-news-api,代码行数:38,代码来源:NewsCollectionUMI.php

示例10: viewAuthor

 public function viewAuthor($author_id = false, $template = "default")
 {
     if ($author_id === false) {
         throw new publicException(getLabel('error-object-does-not-exist', null, $author_id));
     }
     if (!($author = umiObjectsCollection::getInstance()->getObject($author_id))) {
         throw new publicException(getLabel('error-object-does-not-exist', null, $author_id));
     }
     if (!$template) {
         $template = "default";
     }
     list($template_user, $template_guest, $template_sv) = def_module::loadTemplates("users/author/{$template}", "user_block", "guest_block", "sv_block");
     $block_arr = array();
     if ($author->getTypeId() == umiObjectTypesCollection::getInstance()->getBaseType('users', 'user')) {
         $template = $template_user;
         $block_arr['user_id'] = $author_id;
         $user = $author;
         $block_arr['nickname'] = $user->getValue("login");
         $block_arr['email'] = $user->getValue("e-mail");
         $block_arr['fname'] = $user->getValue("fname");
         $block_arr['lname'] = $user->getValue("lname");
         $block_arr['subnodes:groups'] = $groups = $user->getValue("groups");
         if (in_array(SV_GROUP_ID, $groups)) {
             if ($template_sv) {
                 $template = $template_sv;
             }
         }
     } else {
         if ($author->getValue("is_registrated")) {
             $template = $template_user;
             $block_arr['user_id'] = $user_id = $author->getValue("user_id");
             $user = umiObjectsCollection::getInstance()->getObject($user_id);
             if (!$user instanceof umiObject) {
                 $block_arr['user_id'] = $user_id = intval(regedit::getInstance()->getVal("//modules/users/guest_id"));
                 $user = umiObjectsCollection::getInstance()->getObject($user_id);
             }
             if (!$user instanceof umiObject) {
                 return false;
             }
             $block_arr['nickname'] = $user->getValue("login");
             $block_arr['login'] = $user->getValue("login");
             $block_arr['email'] = $user->getValue("e-mail");
             $block_arr['fname'] = $user->getValue("fname");
             $block_arr['lname'] = $user->getValue("lname");
             $block_arr['subnodes:groups'] = $groups = $user->getValue("groups");
             if (in_array(SV_GROUP_ID, $groups)) {
                 if ($template_sv) {
                     $template = $template_sv;
                 }
             }
         } else {
             $template = $template_guest;
             $block_arr['nickname'] = $author->getValue("nickname");
             $block_arr['email'] = $author->getValue("email");
         }
     }
     return def_module::parseTemplate($template, $block_arr, false, $author_id);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:58,代码来源:__author.php

示例11: getTypeId

 private function getTypeId($veb43610bff4bf58aa2af0ba56299d57a)
 {
     if ((string) (int) $veb43610bff4bf58aa2af0ba56299d57a == $veb43610bff4bf58aa2af0ba56299d57a) {
         return (int) $veb43610bff4bf58aa2af0ba56299d57a;
     } else {
         list($v22884db148f0ffb0d830ba431102b0b5, $vea9f6aca279138c58f705c8d4cb4b8ce) = explode("::", $veb43610bff4bf58aa2af0ba56299d57a);
         return umiObjectTypesCollection::getInstance()->getBaseType($v22884db148f0ffb0d830ba431102b0b5, $vea9f6aca279138c58f705c8d4cb4b8ce);
     }
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:9,代码来源:utypeStream.php

示例12: getRuleType

 private static function getRuleType()
 {
     $objectTypes = umiObjectTypesCollection::getInstance();
     $objectTypeId = $objectTypes->getBaseType('emarket', 'discount_rule_type');
     if (!$objectTypeId) {
         throw new coreException("Required data type (emarket::discount_rule_type) not found");
     }
     return $objectTypes->getType($objectTypeId);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:9,代码来源:discountRule.php

示例13: count_users

 public function count_users()
 {
     $typeId = umiObjectTypesCollection::getInstance()->getBaseType("users", "user");
     $type = umiObjectTypesCollection::getInstance()->getType($typeId);
     $isActiveField = $type->getFieldId('is_activated');
     $sel = new umiSelection();
     $sel->addObjectType($typeId);
     $sel->addPropertyFilterEqual($isActiveField, true);
     return umiSelectionsParser::runSelectionCounts($sel);
     $total;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:__list.php

示例14: checkContent

 public static function checkContent($v9a0364b9e99bb480dd25e1f0284c8555)
 {
     $vd499d2db30467ffbbfcf1188e3fa1327 = umiObjectTypesCollection::getInstance()->getTypeIdByGUID('blacklist');
     $v1c73f663c4ea5257b7145fd2f7c598ae = umiObjectsCollection::getInstance()->getGuidedItems($vd499d2db30467ffbbfcf1188e3fa1327);
     foreach ($v1c73f663c4ea5257b7145fd2f7c598ae as $vd1f5ee0092ec47708f200415f2a89717 => $vc47d187067c6cf953245f128b5fde62a) {
         if (strpos($v9a0364b9e99bb480dd25e1f0284c8555, $vc47d187067c6cf953245f128b5fde62a) !== false) {
             return false;
         }
     }
     return true;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:antiSpamHelper.php

示例15: checkPaymentProps

		private static function checkPaymentProps(iUmiObject $object) {
			if($object->payment_type_id) {
				$types = umiObjectTypesCollection::getInstance();
				$typeObject = selector::get('object')->id($object->payment_type_id);
				$typeId = $types->getTypeIdByGUID($typeObject->payment_type_guid);
				if($typeId != $object->getTypeId()) {
					$object->setTypeId($typeId);
					$object->commit();
				}
			}
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:__admin_payments.php


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