• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP umiHierarchy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getBindedPage

 public function getBindedPage($formId = false)
 {
     if ($formId === false) {
         $formId = ($tmp = getRequest('param0')) ? $tmp : $formId;
     }
     if (!$formId) {
         return array('page' => array('attribute:id' => 0));
     }
     $hType = umiHierarchyTypesCollection::getInstance()->getTypeByName('webforms', 'page');
     $typeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($hType->getId());
     $type = umiObjectTypesCollection::getInstance()->getType($typeId);
     $sel = new umiSelection();
     $sel->addElementType($hType->getId());
     $sel->addActiveFilter(true);
     $sel->addPropertyFilterEqual($type->getFieldId('form_id'), $formId);
     $result = umiSelectionsParser::runSelection($sel);
     if (!empty($result)) {
         return array('page' => array('attribute:id' => $result[0], 'attribute:href' => umiHierarchy::getInstance()->getPathById($result[0])));
     }
     $sel = new umiSelection();
     $sel->addElementType($hType->getId());
     $sel->addActiveFilter(false);
     $sel->addPropertyFilterEqual($type->getFieldId('form_id'), $formId);
     $result = umiSelectionsParser::runSelection($sel);
     if (!empty($result)) {
         return array('page' => array('attribute:id' => $result[0], 'attribute:href' => umiHierarchy::getInstance()->getPathById($result[0])));
     }
     return array('page' => array('attribute:id' => 0));
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:29,代码来源:class.php


示例2: 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


示例3: validateItem

		public function validateItem(iUmiHierarchyElement $orderItem) {
			if(!is_array($this->catalog_items)) {
				return false;
			}
			
			foreach($this->catalog_items as $catalogItem) {
				if($catalogItem->id == $orderItem->id) {
					return true;
				}
			}
			
			$parentId = $orderItem->getParentId();
			if($parentId) {
				$hierarchy = umiHierarchy::getInstance();
				$parents = $hierarchy->getAllParents($parentId, true);
				if(isset($parents[0])) unset($parents[0]);
				foreach($this->catalog_items as $catalogItem) {
					if(in_array($catalogItem->id, $parents)) {
						return true;
					}
				}
			}
			
			return false;
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:25,代码来源:items.php


示例4: 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


示例5: onCloneElement

 public function onCloneElement(iUmiEventPoint $oEventPoint)
 {
     if ($oEventPoint->getMode() == 'after') {
         /**
          * @var umiHierarchy
          */
         $hierarchy = umiHierarchy::getInstance();
         $elementId = $oEventPoint->getParam('newElementId');
         /**
          * @var umiHierarchyElement
          */
         $element = $hierarchy->getElement($elementId);
         if ($element && $element->getTypeId() == umiHierarchyTypesCollection::getInstance()->getTypeByName('vote', 'poll')->getId()) {
             $collection = umiObjectsCollection::getInstance();
             $answersIDs = $element->getValue('answers');
             $newAnswers = array();
             foreach ($answersIDs as $answerId) {
                 if ($newAnswerId = $collection->cloneObject($answerId)) {
                     $newAnswers[] = $newAnswerId;
                     $answer = $collection->getObject($newAnswerId);
                     $answer->setValue('poll_rel', $elementId);
                     $answer->setValue('count', 0);
                     $answer->commit();
                 }
             }
             $element->setValue('answers', $newAnswers);
             $element->commit();
         }
     }
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:30,代码来源:__events_handlers.php


示例6: 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


示例7: isHierarchyAllowed

 public function isHierarchyAllowed($element_id)
 {
     $element = umiHierarchy::getInstance()->getElement($element_id);
     if (!$element) {
         return true;
     }
     if ($element->getIsDefault()) {
         return true;
     }
     $allowed_pages = array('emarket', 'webforms', 'users', 'catalog');
     $type = umiHierarchyTypesCollection::getInstance()->getType($element->getTypeId());
     if (in_array($type->getName(), $allowed_pages)) {
         return true;
     }
     $allowed_hierarchy_elements = $this->getValue('iframe_pages');
     if (empty($allowed_hierarchy_elements)) {
         return false;
     }
     foreach ($allowed_hierarchy_elements as $hierarchy_element) {
         if ($hierarchy_element->getId() == $element_id) {
             return true;
         }
     }
     foreach ($allowed_hierarchy_elements as $hierarchy_element) {
         if (umiHierarchy::getInstance()->hasParent($element_id, $hierarchy_element)) {
             return true;
         }
     }
     return false;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:30,代码来源:vkontakte.php


示例8: 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


示例9: parsePath

 protected function parsePath($vd6fe1d0be6347b8ef2427fa629c04485)
 {
     $vd6fe1d0be6347b8ef2427fa629c04485 = parent::parsePath($vd6fe1d0be6347b8ef2427fa629c04485);
     $v47c80780ab608cc046f2a6e6f071feb6 = explode("/", $vd6fe1d0be6347b8ef2427fa629c04485);
     if (sizeof($v47c80780ab608cc046f2a6e6f071feb6) >= 2) {
         switch ($v47c80780ab608cc046f2a6e6f071feb6[0]) {
             case "dominant":
                 $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance();
                 return $vb81ca7c0ccaa77e7aa91936ab0070695->getDominantTypeId($this->getTypeId($v47c80780ab608cc046f2a6e6f071feb6[1]));
             case "child":
                 $vdb6d9b451b818ccc9a449383f2f0c450 = umiObjectTypesCollection::getInstance();
                 return $vdb6d9b451b818ccc9a449383f2f0c450->getChildClasses($this->getTypeId($v47c80780ab608cc046f2a6e6f071feb6[1]));
         }
     }
     $v47c80780ab608cc046f2a6e6f071feb6 = explode(".", $vd6fe1d0be6347b8ef2427fa629c04485);
     if (is_array($v47c80780ab608cc046f2a6e6f071feb6)) {
         $vd6fe1d0be6347b8ef2427fa629c04485 = trim($v47c80780ab608cc046f2a6e6f071feb6[0], '/');
         if (sizeof($v47c80780ab608cc046f2a6e6f071feb6) > 1) {
             $this->group_name = $v47c80780ab608cc046f2a6e6f071feb6[1];
         }
         if (sizeof($v47c80780ab608cc046f2a6e6f071feb6) > 2) {
             $this->field_name = $v47c80780ab608cc046f2a6e6f071feb6[2];
         }
     }
     return $vd6fe1d0be6347b8ef2427fa629c04485;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:26,代码来源:utypeStream.php


示例10: onPageCreate

 public function onPageCreate(iUmiEventPoint $event)
 {
     if (!$event->getRef('element') instanceof umiHierarchyElement) {
         return;
     }
     $pageId = $event->getRef('element')->getId();
     $hierarchy = umiHierarchy::getInstance();
     $page = $hierarchy->getElement($pageId);
     $postparams = http_build_query(array('message' => $page->content, 'title' => $page->name, 'link' => 'http://netizenhostels.com' . $hierarchy->getPathById($page->id) . '?media=mobile'));
     $options = array("http" => array("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => $postparams));
     $context = stream_context_create($options);
     $result = file_get_contents('http://netizen.octopod.com/push/send_message.php', false, $context);
     //	        if ($page->getIsActive()) {
     //	        file_get_contents('http://netizen.octopod.com/push/send_message.php?message='.$page->altName);
     /*
     				file_put_contents(
     					sys_get_temp_dir().'/zzzzzy',print_r(array(
     						'id' => $page->id,
     						'name' => $page->name,
     						'permalink' => $page->altName,
     						'anons' => $page->anons,
     						'content' => $page->content,
     						'url' => $hierarchy->getPathById($page->id)
     					),true)
     				);
     */
     //	        }
 }
开发者ID:sd-studio,项目名称:nz,代码行数:28,代码来源:__custom.php


示例11: add

		public function add() {
			$parent = $this->expectElement("param0");
			$type = (string) getRequest("param1");
			$mode = (string) getRequest("param2");

			$this->setHeaderLabel("header-news-add-" . $type);

			$inputData = Array(	"type" => $type,
						"parent" => $parent,
						'type-id' => getRequest('type-id'),
						"allowed-element-types" => Array('rubric', 'item'));

			if($mode == "do") {
				$element_id = $this->saveAddedElementData($inputData);
				if($type == "item") {
					umiHierarchy::getInstance()->moveFirst($element_id, ($parent instanceof umiHierarchyElement)?$parent->getId():0);
				}
				$this->chooseRedirect();
			}

			$this->setDataType("form");
			$this->setActionType("create");

			$data = $this->prepareData($inputData, "page");

			$this->setData($data);
			return $this->doData();
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:28,代码来源:__admin.php


示例12: prepareElementsToExport

		public function prepareElementsToExport() {

			$objectId = getRequest('param0');

			$complete = false;
			$objects = umiObjectsCollection::getInstance();
			$object = $objects->getObject($objectId);
			$formatId = $object->format;
			$format = $objects->getObject($formatId);
			$suffix = $format->sid;
			if($suffix != 'YML') {
				$data = array(
					"attribute:complete" => (int) $complete,
					"attribute:preparation" => (int) !$complete,
				);

				baseModuleAdmin::setData($data);
				return baseModuleAdmin::doData();
			}

			$offset = (int) getSession("export_offset_" . $objectId);
			$blockSize = mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") ? mainConfiguration::getInstance()->get("modules", "exchange.splitter.limit") : 25;

			if(!file_exists(CURRENT_WORKING_DIR . "/sys-temp/yml/" . $objectId . 'el')) {
				throw new publicException('<a href="' . getLabel("label-errors-no-information") . '" target="blank">' . getLabel("label-errors-no-information") .'</a>');
			}

			$elementsToExport = unserialize(file_get_contents(CURRENT_WORKING_DIR . "/sys-temp/yml/" . $objectId . 'el'));
			$elements = umiHierarchy::getInstance();

			$errors = array();
			for ($i = $offset; $i <= $offset + $blockSize -1; $i++) {
				if(!array_key_exists($i, $elementsToExport)) {
					$complete = true;
					break;
				}
				$element = $elements->getElement($elementsToExport[$i]);
				if($element instanceof umiHierarchyElement) {
					try {
						$element->updateYML();
					} catch (Exception $e) {
						$errors[] = $e->getMessage() . " #{$elementsToExport[$i]}";
					}
				}
			}

			$_SESSION["export_offset_" . $objectId] = $offset + $blockSize;
			if ($complete) {
				unset($_SESSION["export_offset_" . $objectId]);
			}

			$data = array(
				"attribute:complete" => (int) $complete,
				"nodes:log" => $errors
			);

			baseModuleAdmin::setData($data);
			return baseModuleAdmin::doData();
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:59,代码来源:__export.php


示例13: size_table

 public function size_table()
 {
     $page = umiHierarchy::getInstance()->getElement(112);
     //print_r($page);die;
     $res = $page->getValue('content');
     umiHierarchy::getInstance()->unloadElement($id);
     return $res;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:8,代码来源:__custom.php


示例14: __construct

 /**
  * Защищённый конструктор
  * @param int $catalogId ID категории каталога
  */
 protected function __construct($catalogId)
 {
     $this->catalogId = $catalogId;
     $this->cache = new kFiltersCache();
     $this->objectsTypeId = umiHierarchy::getInstance()->getDominantTypeId($this->catalogId);
     $this->sContentTable = umiBranch::getBranchedTableByTypeId($this->objectsTypeId);
     $this->customLogic = new kFiltersCustomLogic($this->catalogId, $this->objectsTypeId);
 }
开发者ID:kibal4iw,项目名称:kfilters,代码行数:12,代码来源:kFilters.php


示例15: setName

 public function setName($vb068931cc450442b63f5b3d276ea4297)
 {
     $vb068931cc450442b63f5b3d276ea4297 = umiHierarchy::convertAltName($vb068931cc450442b63f5b3d276ea4297, "_");
     $this->name = umiObjectProperty::filterInputString($vb068931cc450442b63f5b3d276ea4297);
     if (!strlen($this->name)) {
         $this->name = '_';
     }
     $this->setIsUpdated();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:9,代码来源:umiField.php


示例16: page

 public function page($v7552cd149af7495ee7d8225974e50f80)
 {
     $vb81ca7c0ccaa77e7aa91936ab0070695 = umiHierarchy::getInstance();
     if (is_numeric($v7552cd149af7495ee7d8225974e50f80) == false) {
         $v7552cd149af7495ee7d8225974e50f80 = $vb81ca7c0ccaa77e7aa91936ab0070695->getIdByPath($v7552cd149af7495ee7d8225974e50f80);
     }
     if ($v7552cd149af7495ee7d8225974e50f80 !== false) {
         $this->elementId = (int) $v7552cd149af7495ee7d8225974e50f80;
     }
     return $this;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:where.php


示例17: trash_empty

 public function trash_empty()
 {
     $limit = 100;
     $c = umiHierarchy::getInstance()->removeDeletedWithLimit($limit);
     $buffer = outputBuffer::current('HTTPOutputBuffer');
     $buffer->charset("utf-8");
     $buffer->contentType("text/xml");
     $data = array("attribute:complete" => (int) ($c < $limit), "attribute:deleted" => $c);
     baseModuleAdmin::setData($data);
     return baseModuleAdmin::doData();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:11,代码来源:__trash.php


示例18: makeElementFromExisting

 public function makeElementFromExisting($sourceId, $parentId, $newHTypeId, $additionalCopyPairs = array())
 {
     static $oldPrivacyFriends = 0;
     static $oldPrivacyOwner = 0;
     $hierarchy = umiHierarchy::getInstance();
     $objects = umiObjectsCollection::getInstance();
     $typesCollection = umiObjectTypesCollection::getInstance();
     // Prepare privacy values
     if (!($oldPrivacyFriends && $oldPrivacyOwner)) {
         $privacyType = $typesCollection->getBaseType('blogs', 'blog_privacy');
         $privacyValues = $objects->getGuidedItems($privacyType);
         foreach ($privacyValues as $privacyKindId => $privacyKindName) {
             if ($privacyKindName == 'friends') {
                 $oldPrivacyFriends = $privacyKindId;
             }
             if ($privacyKindName == 'owner') {
                 $oldPrivacyOwner = $privacyKindOwner;
             }
         }
     }
     $newType = $typesCollection->getType($typesCollection->getTypeByHierarchyTypeId($newHTypeId));
     // Clone element data (relations etc.)
     $source = $hierarchy->getElement($sourceId, true, false);
     $newId = $hierarchy->copyElement($sourceId, $parentId, false);
     $new = $hierarchy->getElement($newId);
     $new->setTypeId($newHTypeId);
     // Creating the tata object
     $sourceObject = $new->getObject();
     $newObjectId = $objects->addObject($sourceObject->getName(), $newType->getId());
     $newObject = $objects->getObject($newObjectId);
     // Copying the data
     $objectFields = $newType->getAllFields();
     foreach ($objectFields as $field) {
         $value = $sourceObject->getValue($field->getName());
         if ($value !== false) {
             $newObject->setValue($field->getName(), $value);
         }
     }
     foreach ($additionalCopyPairs as $fromFieldName => $toFieldName) {
         $newObject->setValue($toFieldName, $sourceObject->getValue($fromFieldName));
     }
     switch ($sourceObject->getValue('privacy')) {
         case $oldPrivacyFriends:
             $newObject->setValue('only_for_friends', 1);
             break;
         case $oldPrivacyOwner:
             $new->setIsActive(false);
             break;
     }
     $newObject->setOwnerId($sourceObject->getOwnerId());
     $new->setObject($newObject);
     return $newId;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:53,代码来源:__import.php


示例19: confirmUserAnswer

 public function confirmUserAnswer($oElement)
 {
     $bConfirmUserAnswer = (bool) regedit::getInstance()->getVal("//modules/faq/confirm_user_answer");
     if (!$bConfirmUserAnswer) {
         return true;
     }
     if ($oElement instanceof umiHierarchyElement && $oElement->getIsActive()) {
         $iAuthorId = $oElement->getValue("author_id");
         $author_name = "";
         $author_email = "";
         $oAuthor = umiObjectsCollection::getInstance()->getObject($iAuthorId);
         if ($oAuthor instanceof umiObject) {
             $author_user = null;
             if ($oAuthor->getValue("is_registrated")) {
                 $user_id = $oAuthor->getValue("user_id");
                 $author_user = umiObjectsCollection::getInstance()->getObject($user_id);
             }
             if ($author_user instanceof umiObject) {
                 // author user
                 $author_name = $author_user->getValue("lname") . " " . $author_user->getValue("fname");
                 $author_email = $author_user->getValue("e-mail");
             } else {
                 // author guest
                 $author_name = $oAuthor->getValue("nickname");
                 $author_email = $oAuthor->getValue("email");
             }
         }
         if (umiMail::checkEmail($author_email)) {
             list($sMailSubject, $sMailBody) = def_module::loadTemplatesForMail("faq/default", "answer_mail_subj", "answer_mail");
             $block_arr = array();
             $block_arr['domain'] = $sDomain = $_SERVER['HTTP_HOST'];
             $block_arr['element_id'] = $iElementId = $oElement->getId();
             $block_arr['author_id'] = $oElement->getValue("author_id");
             $bOldFHStatus = umiHierarchy::getInstance()->forceAbsolutePath(true);
             $block_arr['question_link'] = umiHierarchy::getInstance()->getPathById($iElementId);
             umiHierarchy::getInstance()->forceAbsolutePath($bOldFHStatus);
             $block_arr['ticket'] = $iElementId;
             $sSubject = def_module::parseTemplateForMail($sMailSubject, $block_arr, $iElementId);
             $sBody = def_module::parseTemplateForMail($sMailBody, $block_arr, $iElementId);
             $from = regedit::getInstance()->getVal("//settings/fio_from");
             $from_email = regedit::getInstance()->getVal("//settings/email_from");
             $oMail = new umiMail();
             $oMail->addRecipient($author_email);
             $oMail->setFrom($from_email, $from);
             $oMail->setSubject($sSubject);
             $oMail->setContent($sBody);
             $oMail->commit();
         }
     }
     return true;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:51,代码来源:__event_handlers.php


示例20: stores

 public function stores($elementId, $template = 'default')
 {
     if (!$template) {
         $tempate = 'default';
     }
     $hierarchy = umiHierarchy::getInstance();
     $objects = umiObjectsCollection::getInstance();
     list($tpl_block, $tpl_block_empty, $tpl_item) = def_module::loadTemplates("emarket/stores/" . $template, 'stores_block', 'stores_block_empty', 'stores_item');
     $elementId = $this->analyzeRequiredPath($elementId);
     if ($elementId == false) {
         throw new publicException("Wrong element id given");
     }
     $element = $hierarchy->getElement($elementId);
     if ($element instanceof iUmiHierarchyElement == false) {
         throw new publicException("Wrong element id given");
     }
     $storesInfo = $element->stores_state;
     $items_arr = array();
     $stores = array();
     $total = 0;
     if (is_array($storesInfo)) {
         foreach ($storesInfo as $storeInfo) {
             $object = $objects->getObject(getArrayKey($storeInfo, 'rel'));
             if ($object instanceof iUmiObject) {
                 $amount = (int) getArrayKey($storeInfo, 'int');
                 $total += $amount;
                 $store = array('attribute:amount' => $amount);
                 if ($object->primary) {
                     $reserved = (int) $element->reserved;
                     $store['attribute:amount'] -= $reserved;
                     $store['attribute:reserved'] = $reserved;
                     $store['attribute:primary'] = 'primary';
                 }
                 $store['item'] = $object;
                 $stores[] = $store;
                 $items_arr[] = def_module::parseTemplate($tpl_item, array('store_id' => $object->id, 'amount' => $amount, 'name' => $object->name), false, $object->id);
             }
         }
     }
     $result = array('stores' => array('attribute:total-amount' => $total, 'nodes:store' => $stores));
     $result['void:total-amount'] = $total;
     $result['void:items'] = $items_arr;
     if (!$total) {
         $tpl_block = $tpl_block_empty;
     }
     return def_module::parseTemplate($tpl_block, $result);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:47,代码来源:__stores.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP umiObjectTypesCollection类代码示例发布时间:2022-05-23
下一篇:
PHP ui_sysmessage类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap