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


PHP selector::length方法代码示例

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


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

示例1: 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;
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:54,代码来源:__sysevents.php

示例2: create

 /**
  * Создать новый пустой заказ
  * @return Integer $order id нового заказа
  */
 public static function create($useDummyOrder = false)
 {
     $objectTypes = umiObjectTypesCollection::getInstance();
     $objects = umiObjectsCollection::getInstance();
     $permissions = permissionsCollection::getInstance();
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $orderTypeId = $objectTypes->getBaseType('emarket', 'order');
     if ($useDummyOrder) {
         $sel = new selector('objects');
         $sel->types('object-type')->name('emarket', 'order');
         $sel->where('name')->equals('dummy');
         $sel->limit(0, 1);
         if ($sel->length()) {
             $orderId = $sel->first->id;
         } else {
             $orderTypeId = $objectTypes->getBaseType('emarket', 'order');
             $orderId = $objects->addObject('dummy', $orderTypeId);
             $order = $objects->getObject($orderId);
             if ($order instanceof iUmiObject == false) {
                 throw new publicException("Can't load dummy object for order #{$orderId}");
             } else {
                 $order->setValue('domain_id', $domainId);
                 $order->commit();
             }
         }
         return self::get($orderId);
     }
     $managerId = 0;
     $statusId = self::getStatusByCode('basket');
     $customer = customer::get();
     $createTime = time();
     $orderId = $objects->addObject('', $orderTypeId);
     $order = $objects->getObject($orderId);
     if ($order instanceof iUmiObject == false) {
         throw new publicException("Can't load created object for order #{$orderId}");
     }
     $order->domain_id = $domainId;
     $order->manager_id = $managerId;
     $order->status_id = $statusId;
     $order->customer_id = $customer->getId();
     $order->order_create_date = $createTime;
     $order->commit();
     $customer->setLastOrder($orderId, $domainId);
     return self::get($orderId);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:51,代码来源:order.php

示例3: list_files

		public function list_files($element_id = false, $template = "default", $per_page = false, $ignore_paging = false) {
			if(!$template) $template = "default";
			list($template_block, $template_line) = def_module::loadTemplates("filemanager/".$template, "list_files", "list_files_row");

			$block_arr = Array();

			$element_id = $this->analyzeRequiredPath($element_id);

			if(!$per_page) $per_page = $this->per_page;
			$curr_page = (int) getRequest('p');
			if($ignore_paging) $curr_page = 0;

			$sel = new selector('pages');
			$sel->types('hierarchy-type')->name('filemanager', 'shared_file');
			$sel->where('hierarchy')->page($element_id)->childs(100);
			$sel->limit($curr_page, $per_page);

			$result = $sel->result();
			$total = $sel->length();

			$lines = Array();
			foreach($result as $element) {
				$line_arr = Array();

				$next_element_id = $element->getId();

				$line_arr['attribute:id'] = $element->getId();
				$line_arr['attribute:name'] = $element->getName();
				$line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($next_element_id);
				$line_arr['attribute:downloads-count'] = $element->getValue('downloads_counter');
				$line_arr['xlink:download-link'] = $this->pre_lang . "/filemanager/download/" . $next_element_id;
				$line_arr['xlink:href'] = "upage://" . $next_element_id;
				$line_arr['node:desc'] = $element->getValue("content");

				$this->pushEditable("filemanager", "shared_file", $next_element_id);

				$lines[] = self::parseTemplate($template_line, $line_arr, $next_element_id);
			}

			$block_arr['nodes:items'] = $block_arr['void:lines'] = $lines;
			$block_arr['per_page'] = $per_page;
			$block_arr['total'] = $total;

			return self::parseTemplate($template_block, $block_arr);
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:45,代码来源:class.php

示例4: 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);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:41,代码来源:class.php

示例5: result

 /**
  * Возвращает страницу "Заказ оформлен/Неудалось оформить"
  * @param order $order
  * @param String $step - результат оформления заказа (успешно/нет)
  * @param $mode
  * @param String $template
  * @return Array
  */
 public function result(order $order, $step, $mode, $template)
 {
     list($tpl_successful, $tpl_failed) = def_module::loadTemplates("emarket/" . $template, 'purchase_successful', 'purchase_failed');
     $tpl_block = $step == 'successful' ? $tpl_successful : $tpl_failed;
     if ($order->isEmpty()) {
         $customer = customer::get();
         $domain = cmsController::getInstance()->getCurrentDomain();
         $domainId = $domain->getId();
         $sel = new selector('objects');
         $sel->types('object-type')->name('emarket', 'order');
         $sel->where('customer_id')->equals($customer->getId());
         $sel->where('domain_id')->equals($domainId);
         $sel->order('id')->desc();
         if ($sel->length()) {
             $orderId = $sel->first->id;
         }
     } else {
         $orderId = $order->getId();
     }
     $result = array('status' => $step, 'order' => array('attribute:id' => $orderId), 'void:order_id' => $orderId);
     return def_module::parseTemplate($tpl_block, $result);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:30,代码来源:__purchasing.php

示例6: release_send

    public function release_send()
    {
        $buffer = outputBuffer::current('HTTPOutputBuffer');
        $buffer->charset('utf-8');
        $buffer->contentType('text/xml');
        $buffer->push('<?xml version="1.0" encoding="utf-8"?>');
        $iDispId = (int) getRequest('param0');
        $iReleaseId = $this->getNewReleaseInstanceId($iDispId);
        $arrPostData = getRequest("data_values");
        $objectsColl = umiObjectsCollection::getinstance();
        $controller = cmsController::getInstance();
        $oDispatch = $objectsColl->getObject($iDispId);
        $oRelease = $objectsColl->getObject($iReleaseId);
        if (!$oDispatch instanceof umiObject || !$oRelease instanceof umiObject) {
            $buffer->push("<error>Не указан идентификатор рассылки</error>");
            $buffer->end();
        }
        if ($oRelease->getValue('status')) {
            $buffer->push("<error>Этот выпуск уже был отправлен</error>");
            $buffer->end();
        }
        $arrRecipients = array();
        if (!getSession('umi_send_list_' . $iReleaseId)) {
            $sel = new selector('objects');
            $sel->types("object-type")->name("dispatches", "subscriber");
            $sel->where("subscriber_dispatches")->equals($iDispId);
            $sel->option('return')->value('id');
            $sel->group("name");
            foreach ($sel->result() as $recipient) {
                $arrRecipients[] = $recipient['id'];
            }
            $_SESSION['umi_send_list_' . $iReleaseId] = $arrRecipients;
            $_SESSION['umi_send_list_' . $iReleaseId . '_count'] = count($arrRecipients);
        } else {
            $arrRecipients = getSession('umi_send_list_' . $iReleaseId);
        }
        $delay = getSession('umi_send_list_' . $iReleaseId . '_delay');
        $iTotal = (int) getSession('umi_send_list_' . $iReleaseId . '_count');
        if ($delay and time() < $delay) {
            $iSended = $iTotal - count($arrRecipients);
            $sResult = <<<END
<release dispatch="{$iDispId}">
\t<total>{$iTotal}</total>
\t<sended>{$iSended}</sended>
</release>
END;
            $buffer->push($sResult);
            $buffer->end();
        }
        $sHost = $controller->getCurrentDomain()->getHost();
        $oMailer = new umiMail();
        $arrMailBlocks = array();
        $arrMailBlocks['header'] = $oDispatch->getName();
        $arrMailBlocks['messages'] = "";
        list($sReleaseFrm, $sMessageFrm) = def_module::loadTemplatesForMail("dispatches/release", "release_body", "release_message");
        $sel = new selector('objects');
        $sel->types("object-type")->name("dispatches", "message");
        $sel->where("release_reference")->equals($iReleaseId);
        if ($sel->length()) {
            foreach ($sel->result() as $oNextMsg) {
                if ($oNextMsg instanceof umiObject) {
                    $arrMsgBlocks = array();
                    $arrMsgBlocks['body'] = $oNextMsg->getValue('body');
                    $arrMsgBlocks['header'] = $oNextMsg->getValue('header');
                    $arrMailBlocks['messages'] .= def_module::parseTemplateForMail($sMessageFrm, $arrMsgBlocks, false, $oNextMsg->getId());
                    $oNextAttach = $oNextMsg->getValue('attach_file');
                    if ($oNextAttach instanceof umiFile && !$oNextAttach->getIsBroken()) {
                        $oMailer->attachFile($oNextAttach);
                    }
                }
            }
        } else {
            unset($_SESSION[$iDispId . '_new_templater']);
            $buffer->push("<error>В выпуске нет сообщений</error>");
            $buffer->end();
        }
        $oMailer->setFrom(regedit::getInstance()->getVal("//settings/email_from"), regedit::getInstance()->getVal("//settings/fio_from"));
        $oMailer->setSubject($arrMailBlocks['header']);
        $delay = 0;
        $max_messages = (int) mainConfiguration::getinstance()->get('modules', 'dispatches.max_messages_in_hour');
        if ($max_messages && $iTotal >= $max_messages) {
            $delay = floor(3600 / $max_messages);
        }
        $aSended = array();
        $iPacketSize = 5;
        //TODO: add to settings
        foreach ($arrRecipients as $recipient_id) {
            --$iPacketSize;
            $oNextMailer = clone $oMailer;
            $oNextSbs = new umiSubscriber($recipient_id);
            $sRecipientName = $oNextSbs->getValue('lname') . " " . $oNextSbs->getValue('fname') . " " . $oNextSbs->getValue('father_name');
            $mail = $oNextSbs->getValue('email');
            if (!strlen($mail)) {
                $mail = $oNextSbs->getName();
            }
            $arrMailBlocks['unsubscribe_link'] = "http://" . $sHost . "/dispatches/unsubscribe/" . $oNextSbs->getId() . '/?email=' . $mail;
            $sMailBody = def_module::parseTemplateForMail($sReleaseFrm, $arrMailBlocks, false, $oNextSbs->getId());
            $oNextMailer->setContent($sMailBody);
            $oNextMailer->addRecipient($mail, $sRecipientName);
            if (!(defined('CURRENT_VERSION_LINE') && CURRENT_VERSION_LINE == 'demo')) {
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:101,代码来源:__releasees.php

示例7: listGroup

 public function listGroup($elementPath, $level = 1)
 {
     // Сделать выборку по групповым элементам
     $pages = new selector('pages');
     $pages->types('hierarchy-type')->name('modulelements', 'groupelements');
     // Если не указан каталог то вывести корневые каталоги
     if ((string) $elementPath != '0') {
         $elementPath = $this->analyzeRequiredPath($elementPath);
         $pages->where('hierarchy')->page($elementPath)->childs($level);
     } else {
         $pages->where('hierarchy')->page('root');
     }
     $block_arr = array();
     $lines = array();
     $hierarchy = umiHierarchy::getInstance();
     foreach ($pages as $page) {
         $element_id = $page->id;
         $element = $hierarchy->getElement($element_id);
         if (!$element) {
             continue;
         }
         // just for safe code
         $line_arr = array();
         $line_arr['attribute:id'] = $page->id;
         $line_arr['attribute:name'] = $element->getName();
         $line_arr['attribute:link'] = $hierarchy->getPathById($element_id);
         $line_arr['xlink:href'] = 'upage://' . $element_id;
         if ($cur_page_id == $element_id) {
             $line_arr['attribute:active'] = '1';
         }
         $lines[] = $line_arr;
     }
     $block_arr['subnodes:items'] = $lines;
     $block_arr['total'] = $pages->length();
     return $this->parseTemplate('', $block_arr, null);
 }
开发者ID:tomoonshine,项目名称:postsms,代码行数:36,代码来源:class.php

示例8: widget

		public function widget() {

			$buffer = outputBuffer::current();
			$buffer->contentType('text/javascript');
			$buffer->option('generation-time', false);
			$buffer->clear();

			$permissions = permissionsCollection::getInstance();
			$objects = umiObjectsCollection::getInstance();
			$controller = cmsController::getInstance();
			$regedit = regedit::getInstance();
			$host = "http://" . $controller->getCurrentDomain()->getHost();
			$interval = $regedit->getVal("//modules/stat/request-time");
			$interval = $interval > 0 ? $interval : 600;
			$regExp = "^" . str_replace('.', '\\\\.', $host) . "\/.*";
			
			$showTips = (bool) $regedit->getVal("//modules/stat/tips");
			
			$answer = <<<EOD
{
	"version": 3,
	"update_interval": $interval,
	"update_url_regexps": [
		"$regExp"
	],
	"buttons": [
EOD;
			$userId = $permissions->getUserId();
			$comma = false;

			if ($userId != $objects->getObjectIdByGUID('system-guest')) {

				//пользователи
				if ($regedit->getVal("//modules/stat/users-user") && $controller->getModule("users") && $permissions->isAllowedMethod($userId, "users", "users_list_all")) {

					$sel = new selector('objects');
					$sel->types('object-type')->name('users', 'user');
		            $sel->option('return')->value('id');
		            $result = $sel->length();

		            $label = $showTips ? getLabel('option-users-user') : '';
		            
		            $answer .= self::getWidgetPart('users', $label, "{$host}/images/cms/admin/toolbar/users.png", "{$host}/admin/users/users_list_all/", $result, $comma);
		            $comma = true;

				}

				//заказы
				if ($regedit->getVal("//modules/stat/emarket-order") && $controller->getModule("emarket") && $permissions->isAllowedMethod($userId, "emarket", "orders")) {

					$sel = new selector('objects');
					$sel->types('object-type')->name('emarket', 'order');
					$sel->where('name')->isNull(false);
		            $sel->where('name')->notequals('dummy');
		            $sel->option('return')->value('id');
		            $result = $sel->length();

		            $label = $showTips ? getLabel('option-emarket-order') : '';
					
					$answer .= self::getWidgetPart('orders', $label, "{$host}/images/cms/admin/toolbar/orders.png", "{$host}/admin/emarket/orders/", $result, $comma);
		            $comma = true;
				}

				//сообщения обратной связи
				if ($regedit->getVal("//modules/stat/webforms-message") && $controller->getModule("webforms") && $permissions->isAllowedMethod($userId, "webforms", "messages")) {

					$sel = new selector('objects');
					$sel->types('object-type')->name('webforms', 'form');
		            $sel->option('return')->value('id');
		            $result = $sel->length();

		            $label = $showTips ? getLabel('option-webforms-message') : '';
					
					$answer .= self::getWidgetPart('webforms_messages', $label, "{$host}/images/cms/admin/toolbar/messages.png", "{$host}/admin/webforms/messages/", $result, $comma);
		            $comma = true;
				}

				//комментарии
				if ($regedit->getVal("//modules/stat/comments-comment") && $controller->getModule("comments") && $permissions->isAllowedMethod($userId, "comments", "view_comments")) {

					$sel = new selector('pages');
					$sel->types('hierarchy-type')->name('comments', 'comment');
		            $sel->option('return')->value('id');
		            $result = $sel->length();

		            $label = $showTips ? getLabel('option-comments-comment') : '';
					
					$answer .= self::getWidgetPart('comments', $label, "{$host}/images/cms/admin/toolbar/comments.png", "{$host}/admin/comments/view_comments/", $result, $comma);
		            $comma = true;
				}

				//голосования
				if ($regedit->getVal("//modules/stat/vote-poll_item") && $controller->getModule("vote") && $permissions->isAllowedMethod($userId, "vote", "lists")) {

					$sel = new selector('objects');
					$sel->types('object-type')->name('vote', 'poll_item');
					$polls = $sel->result();

					$result = 0;
		            foreach ($polls as $pollItem) {
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:101,代码来源:__admin.php

示例9: placeComments

 /**
  * @desc
  */
 private function placeComments($parentId, $templateString, umiHierarchy $hierarchy, $commentHType, &$total)
 {
     static $postHType = 0;
     if (!$postHType) {
         $postHType = umiHierarchyTypesCollection::getInstance()->getTypeByName('blogs20', 'post')->getId();
     }
     $parent = $hierarchy->getElement($parentId, true);
     if (!$parent instanceof umiHierarchyElement) {
         throw new publicException("Unknown parent element for comments");
     }
     $rootComments = $parent->getTypeId() == $postHType;
     $sel = new selector('pages');
     $sel->where('hierarchy')->page($parentId)->childs(1);
     $sel->types('hierarchy-type')->id($commentHType);
     $sel->where('is_spam')->notequals(1);
     if ($rootComments) {
         $page = (int) getRequest('p');
         $sel->limit($page * $this->comments_per_page, $this->comments_per_page);
     }
     $result = $sel->result();
     $total = $sel->length();
     $aLines = array();
     foreach ($result as $oComment) {
         $commentId = $oComment->getId();
         $temp = 0;
         $pubTime = $oComment->getValue('publish_time');
         $aLineParam = array();
         $aLineParam['attribute:cid'] = $commentId;
         $aLineParam['name'] = $oComment->getName();
         $aLineParam['content'] = $this->prepareContent($oComment->getValue('content'));
         $aLineParam['author_id'] = $oComment->getValue('author_id');
         $aLineParam['publish_time'] = $pubTime instanceof umiDate ? $pubTime->getFormattedDate('U') : time();
         $aLineParam['subnodes:subcomments'] = $this->placeComments($commentId, $templateString, $hierarchy, $commentHType, $temp);
         $aLines[] = self::parseTemplate($templateString, $aLineParam, $commentId);
     }
     return $aLines;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:40,代码来源:class.php


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