本文整理汇总了PHP中selector::result方法的典型用法代码示例。如果您正苦于以下问题:PHP selector::result方法的具体用法?PHP selector::result怎么用?PHP selector::result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selector
的用法示例。
在下文中一共展示了selector::result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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;
}
示例4: 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);
}
示例5: export
public function export($v92ec19ffde05e15769b1bb3ee05ad745)
{
if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
$v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result();
}
$vbbd738a112791dd1d0cb6bd0d61d878f = $this->getUmiDump($v92ec19ffde05e15769b1bb3ee05ad745, "commerceML2");
$vd0c75bac742760cf71fd76cd75d0c02a = './xsl/export/' . $this->type . '.xsl';
if (!is_file($vd0c75bac742760cf71fd76cd75d0c02a)) {
throw new publicException("Can't load exporter {$vd0c75bac742760cf71fd76cd75d0c02a}");
}
$v9a09b4dfda82e3e665e31092d1c3ec8d = new DOMDocument("1.0", "utf-8");
$v9a09b4dfda82e3e665e31092d1c3ec8d->formatOutput = XML_FORMAT_OUTPUT;
$v9a09b4dfda82e3e665e31092d1c3ec8d->loadXML($vbbd738a112791dd1d0cb6bd0d61d878f);
$v640eac53ad75db5c49a9ec86390d8530 = umiTemplater::create('XSLT', $vd0c75bac742760cf71fd76cd75d0c02a);
return $v640eac53ad75db5c49a9ec86390d8530->parse($v9a09b4dfda82e3e665e31092d1c3ec8d);
}
示例6: checkAllMessages
public function checkAllMessages()
{
$service = antiSpamService::get();
if (!$service) {
return;
}
$sel = new selector('pages');
$sel->types->name('comments', 'comment');
$sel->types->name('forum', 'message');
$sel->where('is_spam')->isNull();
foreach ($sel->result() as $page) {
$service->setNick(null);
$service->setLink($page->link);
$service->setContent($page->content);
$page->is_spam = $service->isSpam() ? 2 : 1;
$page->commit();
}
}
示例7: getList
public static final function getList($selfDeliveryOnly = false)
{
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'delivery');
$regedit = regedit::getInstance();
if ((bool) $regedit->getVal('//modules/emarket/delivery-with-address')) {
$types = array();
$typesSel = new selector('objects');
$typesSel->types('object-type')->guid('emarket-deliverytype');
$typesSel->where('class_name')->equals('self');
foreach ($typesSel as $typeId) {
$types[] = $typeId->id;
}
if ($selfDeliveryOnly) {
$sel->where('delivery_type_id')->equals($types);
} else {
$sel->where('delivery_type_id')->notequals($types);
}
}
return $sel->result();
}
示例8: export
public function export($v92ec19ffde05e15769b1bb3ee05ad745)
{
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
$v8be74552df93e31bbdd6b36ed74bdb6a->types('hierarchy-type')->name('catalog', 'object');
if (count($v92ec19ffde05e15769b1bb3ee05ad745)) {
foreach ($v92ec19ffde05e15769b1bb3ee05ad745 as $v9603a224b40d7b67210b78f2e390d00f) {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page($v9603a224b40d7b67210b78f2e390d00f->id)->childs(1000);
}
}
$ved780287e302ec3b9fd3c5e78771919f = new xmlExporter("CommerceML2");
$ved780287e302ec3b9fd3c5e78771919f->addElements($v8be74552df93e31bbdd6b36ed74bdb6a->result());
$ved780287e302ec3b9fd3c5e78771919f->setIgnoreRelations();
$vbbd738a112791dd1d0cb6bd0d61d878f = $ved780287e302ec3b9fd3c5e78771919f->execute();
$vd0c75bac742760cf71fd76cd75d0c02a = './xsl/export/' . $this->type . '.xsl';
if (!is_file($vd0c75bac742760cf71fd76cd75d0c02a)) {
throw new publicException("Can't load exporter {$vd0c75bac742760cf71fd76cd75d0c02a}");
}
$v9a09b4dfda82e3e665e31092d1c3ec8d = new DOMDocument("1.0", "utf-8");
$v9a09b4dfda82e3e665e31092d1c3ec8d->formatOutput = XML_FORMAT_OUTPUT;
$v9a09b4dfda82e3e665e31092d1c3ec8d->loadXML($vbbd738a112791dd1d0cb6bd0d61d878f->saveXML());
$v640eac53ad75db5c49a9ec86390d8530 = umiTemplater::create('XSLT', $vd0c75bac742760cf71fd76cd75d0c02a);
return $v640eac53ad75db5c49a9ec86390d8530->parse($v9a09b4dfda82e3e665e31092d1c3ec8d);
}
示例9: 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')) {
//.........这里部分代码省略.........
示例10: getAllObjects
public function getAllObjects($category_id)
{
$sel = new selector('pages');
$sel->types('hierarchy-type')->name('catalog', 'object');
$sel->where('hierarchy')->page($category_id)->childs(8);
return $sel->result();
}
示例11: export
public function export($v92ec19ffde05e15769b1bb3ee05ad745)
{
$v857a5246dff0c3c79e476b004684f6d3 = CURRENT_WORKING_DIR . "/sys-temp/export/";
$vb80bb7740288fda1f201890375a60c8f = getRequest('param0');
if (!is_dir($v857a5246dff0c3c79e476b004684f6d3)) {
mkdir($v857a5246dff0c3c79e476b004684f6d3, 0777, true);
}
$v8e9e791281df5188f135edcc30eaa97e = $v857a5246dff0c3c79e476b004684f6d3 . $vb80bb7740288fda1f201890375a60c8f . "." . $this->getFileExt();
$v7c95caafbd5e4b5db3977617a0498de6 = $vb80bb7740288fda1f201890375a60c8f . "." . $this->getFileExt();
if (file_exists($v8e9e791281df5188f135edcc30eaa97e) && !file_exists($v8e9e791281df5188f135edcc30eaa97e . 'array')) {
unlink($v8e9e791281df5188f135edcc30eaa97e);
}
$v2a05e4f9b3949ba2c0b7d413a0863c3f = array();
if (!file_exists($v8e9e791281df5188f135edcc30eaa97e . 'array')) {
if (!count($v92ec19ffde05e15769b1bb3ee05ad745)) {
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page(0)->childs(0);
$v92ec19ffde05e15769b1bb3ee05ad745 = $v8be74552df93e31bbdd6b36ed74bdb6a->result;
}
foreach ($v92ec19ffde05e15769b1bb3ee05ad745 as $v8e2dcfd7e7e24b1ca76c1193f645902b) {
if (!$v8e2dcfd7e7e24b1ca76c1193f645902b instanceof umiHierarchyElement) {
$v8e2dcfd7e7e24b1ca76c1193f645902b = umiHierarchy::getInstance()->getElement($v8e2dcfd7e7e24b1ca76c1193f645902b, true, true);
}
if (!$v8e2dcfd7e7e24b1ca76c1193f645902b instanceof umiHierarchyElement) {
continue;
}
$v7552cd149af7495ee7d8225974e50f80 = $v8e2dcfd7e7e24b1ca76c1193f645902b->getId();
$v2a05e4f9b3949ba2c0b7d413a0863c3f[$v7552cd149af7495ee7d8225974e50f80] = $v7552cd149af7495ee7d8225974e50f80;
$vc9e9a848920877e76685b2e4e76de38d = umiHierarchy::getInstance()->getMaxNestingLevel($v7552cd149af7495ee7d8225974e50f80);
if (!$vc9e9a848920877e76685b2e4e76de38d) {
continue;
}
for ($v865c0c0b4ab0e063e5caa3387c1a8741 = 1; $v865c0c0b4ab0e063e5caa3387c1a8741 <= $vc9e9a848920877e76685b2e4e76de38d; $v865c0c0b4ab0e063e5caa3387c1a8741++) {
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('pages');
$v8be74552df93e31bbdd6b36ed74bdb6a->option('return')->value('id');
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page($v7552cd149af7495ee7d8225974e50f80)->childs($v865c0c0b4ab0e063e5caa3387c1a8741);
foreach ($v8be74552df93e31bbdd6b36ed74bdb6a->result() as $v9b207167e5381c47682c6b4f58a623fb) {
$v2a05e4f9b3949ba2c0b7d413a0863c3f[$v9b207167e5381c47682c6b4f58a623fb['id']] = $v9b207167e5381c47682c6b4f58a623fb['id'];
}
}
}
} else {
$v2a05e4f9b3949ba2c0b7d413a0863c3f = unserialize(file_get_contents($v8e9e791281df5188f135edcc30eaa97e . 'array'));
}
$v480d1b61a0432d1319f7504a3d7318dd = false;
if (getRequest('as_file') !== '0') {
$v480d1b61a0432d1319f7504a3d7318dd = (int) mainConfiguration::getInstance()->get("modules", "exchange.export.limit");
if ($v480d1b61a0432d1319f7504a3d7318dd <= 0) {
$v480d1b61a0432d1319f7504a3d7318dd = 25;
}
}
$ved780287e302ec3b9fd3c5e78771919f = new xmlExporter($v7c95caafbd5e4b5db3977617a0498de6, $v480d1b61a0432d1319f7504a3d7318dd);
if (getRequest('as_file') !== '0') {
$ved780287e302ec3b9fd3c5e78771919f->addElements(array_slice($v2a05e4f9b3949ba2c0b7d413a0863c3f, 0, $v480d1b61a0432d1319f7504a3d7318dd + 1));
} else {
$ved780287e302ec3b9fd3c5e78771919f->addElements($v2a05e4f9b3949ba2c0b7d413a0863c3f);
}
$ved780287e302ec3b9fd3c5e78771919f->setIgnoreRelations();
$v9a09b4dfda82e3e665e31092d1c3ec8d = $ved780287e302ec3b9fd3c5e78771919f->execute();
$v10ae9fc7d453b0dd525d0edf2ede7961 = $this->getCSV($v9a09b4dfda82e3e665e31092d1c3ec8d, $v8e9e791281df5188f135edcc30eaa97e);
$ve1260894f59eeae98c8440899de4df8d = fopen($v8e9e791281df5188f135edcc30eaa97e, 'a');
foreach ($v10ae9fc7d453b0dd525d0edf2ede7961 as $vd05b6ed7d2345020440df396d6da7f73) {
$vb45cffe084dd3d20d928bee85e7b0f21 = "\"" . implode('";"', $vd05b6ed7d2345020440df396d6da7f73) . "\"\n";
if ($vb45cffe084dd3d20d928bee85e7b0f21 = @iconv('utf-8', 'windows-1251//IGNORE', $vb45cffe084dd3d20d928bee85e7b0f21)) {
fputs($ve1260894f59eeae98c8440899de4df8d, $vb45cffe084dd3d20d928bee85e7b0f21);
}
}
fclose($ve1260894f59eeae98c8440899de4df8d);
$vaa8fb77e57d1ca18d593e909729871fe = $ved780287e302ec3b9fd3c5e78771919f->isCompleted();
if (getRequest('as_file') !== '0') {
$vb0344c1ba7e309d30b65650c47a422c3 = $ved780287e302ec3b9fd3c5e78771919f->getExportedElements();
$v2a05e4f9b3949ba2c0b7d413a0863c3f = array_diff($v2a05e4f9b3949ba2c0b7d413a0863c3f, $vb0344c1ba7e309d30b65650c47a422c3);
if (count($v2a05e4f9b3949ba2c0b7d413a0863c3f)) {
$this->completed = false;
file_put_contents($v8e9e791281df5188f135edcc30eaa97e . 'array', serialize($v2a05e4f9b3949ba2c0b7d413a0863c3f));
} else {
if (file_exists($v8e9e791281df5188f135edcc30eaa97e . 'array')) {
unlink($v8e9e791281df5188f135edcc30eaa97e . 'array');
}
$this->completed = true;
}
} else {
$this->completed = $vaa8fb77e57d1ca18d593e909729871fe;
}
if ($this->completed) {
$v10ae9fc7d453b0dd525d0edf2ede7961 = unserialize(file_get_contents($v8e9e791281df5188f135edcc30eaa97e . ".tmp"));
$ve1260894f59eeae98c8440899de4df8d = fopen($v8e9e791281df5188f135edcc30eaa97e . ".tmp", 'w');
foreach ($v10ae9fc7d453b0dd525d0edf2ede7961 as $vd05b6ed7d2345020440df396d6da7f73) {
$vb45cffe084dd3d20d928bee85e7b0f21 = "\"" . implode('";"', $vd05b6ed7d2345020440df396d6da7f73) . "\"\n";
if ($vb45cffe084dd3d20d928bee85e7b0f21 = @iconv('utf-8', 'windows-1251//IGNORE', $vb45cffe084dd3d20d928bee85e7b0f21)) {
fwrite($ve1260894f59eeae98c8440899de4df8d, $vb45cffe084dd3d20d928bee85e7b0f21);
}
}
$vd11e7941c75eaca417c6af0d0f9d7d45 = fopen($v8e9e791281df5188f135edcc30eaa97e, 'r');
while ($vb45cffe084dd3d20d928bee85e7b0f21 = fgets($vd11e7941c75eaca417c6af0d0f9d7d45)) {
if (substr_count($vb45cffe084dd3d20d928bee85e7b0f21, '"') % 2 != 0) {
$v132ae73e31f76d8b94f87fe5ccfe28c9 = false;
while (!feof($vd11e7941c75eaca417c6af0d0f9d7d45) && !$v132ae73e31f76d8b94f87fe5ccfe28c9) {
$vb45cffe084dd3d20d928bee85e7b0f21 .= fgets($vd11e7941c75eaca417c6af0d0f9d7d45);
if (substr_count($vb45cffe084dd3d20d928bee85e7b0f21, '"') % 2 == 0) {
//.........这里部分代码省略.........
示例12: getArrayToExport
public function getArrayToExport($elements)
{
$elementsToExport = array();
foreach ($elements as $element) {
if (!$element instanceof umiHierarchyElement) {
continue;
}
$sel = new selector('pages');
$sel->types('hierarchy-type')->name('catalog', 'object');
$sel->option('return')->value('id');
$sel->where('hierarchy')->page($element->getId())->childs(100);
foreach ($sel->result() as $res) {
$elementsToExport[] = $res['id'];
}
$elementsToExport[] = $element->getId();
}
$elementsToExport = array_unique($elementsToExport);
sort($elementsToExport);
return $elementsToExport;
}
示例13: getAddresses
public function getAddresses($iFormId = false)
{
$sel = new selector('objects');
$sel->types('object-type')->name('webforms', 'address');
$result = $sel->result();
$aBlock = array();
$aLines = array();
foreach ($result as $oObject) {
$aLine = array();
$aLine['attribute:id'] = $oObject->getId();
if (in_array($iFormId, explode(',', $oObject->getValue('form_id')))) {
$aLine['attribute:selected'] = 'selected';
}
$aLine['node:text'] = $oObject->getName();
$aLines[] = self::parseTemplate('', $aLine);
}
$aBlock['attribute:input_name'] = "data[address]";
$aBlock['subnodes:items'] = $aLines;
return self::parseTemplate('', $aBlock);
}
示例14: frontendPanel
public function frontendPanel()
{
$permissions = permissionsCollection::getInstance();
$cmsController = cmsController::getInstance();
$maxRecentPages = 5;
$this->flushAsXml('frontendPanel');
$modules = array();
$modulesSortedPriorityList = $this->getSortedModulesList();
foreach ($modulesSortedPriorityList as $moduleInfo) {
$modules[] = array('attribute:label' => $moduleInfo['label'], 'attribute:type' => $moduleInfo['type'], 'node:name' => $moduleInfo['name']);
}
$hierarchy = umiHierarchy::getInstance();
$key = md5(getServer('HTTP_REFERER'));
$currentIds = is_array(getSession($key)) ? getSession($key) : array();
foreach ($currentIds as $i => $id) {
$currentIds[$i] = $id[2];
}
$currentIds = array_unique($currentIds);
$current = array();
foreach ($currentIds as $id) {
$current[] = $hierarchy->getElement($id);
}
$recent = new selector('pages');
$recent->where('is_deleted')->equals(0);
$recent->where('is_active')->equals(1);
$recent->where('lang')->equals(langsCollection::getInstance()->getList());
$recent->order('updatetime')->desc();
$recent->limit(0, $maxRecentPages);
if (sizeof($currentIds) && $permissions->isAllowedModule($permissions->getUserId(), 'backup')) {
$backup = $cmsController->getModule('backup');
$changelog = $backup->backup_panel($currentIds[0]);
} else {
$changelog = null;
}
$user = selector::get('object')->id($permissions->getUserId());
$referer = getRequest('referer') ? getRequest('referer') : getServer('HTTP_REFERER');
$tickets = new selector('objects');
$tickets->types('object-type')->name('content', 'ticket');
$tickets->where('url')->equals($referer);
$tickets->limit(0, 100);
$ticketsResult = array();
foreach ($tickets as $ticket) {
$user = selector::get('object')->id($ticket->user_id);
if (!$user) {
continue;
}
$ticketsResult[] = array('attribute:id' => $ticket->id, 'author' => array('attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'position' => array('attribute:x' => $ticket->x, 'attribute:y' => $ticket->y, 'attribute:width' => $ticket->width, 'attribute:height' => $ticket->height), 'message' => $ticket->message);
}
$result = array('user' => array('attribute:id' => $user->id, 'attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'tickets' => array('nodes:ticket' => $ticketsResult), 'modules' => array('nodes:module' => $modules), 'documents' => array('editable' => array('nodes:page' => $current), 'recent' => array('nodes:page' => $recent->result())));
if (!$permissions->isAllowedMethod($permissions->getUserId(), 'content', 'tickets')) {
unset($result['tickets']);
}
if ($changelog && sizeof($changelog['nodes:revision'])) {
$result['changelog'] = $changelog;
}
$event = new umiEventPoint('eipFrontendPanelGet');
$event->setParam("id", getArrayKey($currentIds, 0));
$event->addRef("result", $result);
$event->setMode('after');
$event->call();
return $result;
}
示例15: 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;
}