本文整理汇总了PHP中selector::option方法的典型用法代码示例。如果您正苦于以下问题:PHP selector::option方法的具体用法?PHP selector::option怎么用?PHP selector::option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selector
的用法示例。
在下文中一共展示了selector::option方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detectHierarchyFilters
static function detectHierarchyFilters(selector $v8be74552df93e31bbdd6b36ed74bdb6a)
{
$v48908871a0d20dd2e5bd0a3d634ac745 = (array) getRequest('rel');
if (sizeof($v48908871a0d20dd2e5bd0a3d634ac745) == 0 && $v8be74552df93e31bbdd6b36ed74bdb6a->mode == 'pages') {
$v8be74552df93e31bbdd6b36ed74bdb6a->option('exclude-nested', true);
}
foreach ($v48908871a0d20dd2e5bd0a3d634ac745 as $vb80bb7740288fda1f201890375a60c8f) {
try {
if ($vb80bb7740288fda1f201890375a60c8f || $vb80bb7740288fda1f201890375a60c8f === '0') {
$v8be74552df93e31bbdd6b36ed74bdb6a->where('hierarchy')->page($vb80bb7740288fda1f201890375a60c8f)->childs(1);
}
if ($vb80bb7740288fda1f201890375a60c8f === '0') {
$v8be74552df93e31bbdd6b36ed74bdb6a->option('exclude-nested', true);
}
} catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
}
}
}
示例2: exportType
protected function exportType($v94757cae63fd3e398c0811a976dd6bbe)
{
$v599dcce2998a6b40b1e38e8c6006cb0a = umiObjectTypesCollection::getInstance()->getType($v94757cae63fd3e398c0811a976dd6bbe);
if (!$v599dcce2998a6b40b1e38e8c6006cb0a instanceof umiObjectType) {
return false;
}
if (isset($this->exported_types[$v94757cae63fd3e398c0811a976dd6bbe])) {
return false;
}
if ($this->limit) {
if ($this->position >= $this->limit) {
$this->break = true;
return false;
}
}
$this->exported_types[$v94757cae63fd3e398c0811a976dd6bbe] = 'found';
$v2e3c048401582f4247d7ccac43657d2d = $v599dcce2998a6b40b1e38e8c6006cb0a->getParentId();
if ($v2e3c048401582f4247d7ccac43657d2d) {
if ($this->exportType($v2e3c048401582f4247d7ccac43657d2d)) {
if ($this->limit && $this->position >= $this->limit) {
$this->break = true;
return true;
}
}
}
$v4a8a08f09d37b73795649038408b5f33 = $this->doc->createElement('type');
$this->translateEntity($v599dcce2998a6b40b1e38e8c6006cb0a, $v4a8a08f09d37b73795649038408b5f33);
$va240be392fd0549ece5558553983d79b = $this->relations->getOldTypeIdRelation($this->source_id, $v94757cae63fd3e398c0811a976dd6bbe);
if (!$va240be392fd0549ece5558553983d79b) {
$va240be392fd0549ece5558553983d79b = $v94757cae63fd3e398c0811a976dd6bbe == self::$ROOT_PAGE_TYPE_ID ? '{root-pages-type}' : $v94757cae63fd3e398c0811a976dd6bbe;
$this->relations->setTypeIdRelation($this->source_id, $va240be392fd0549ece5558553983d79b, $v94757cae63fd3e398c0811a976dd6bbe);
}
$v4a8a08f09d37b73795649038408b5f33->setAttribute('id', $va240be392fd0549ece5558553983d79b);
$v2e3c048401582f4247d7ccac43657d2d = $v599dcce2998a6b40b1e38e8c6006cb0a->getParentId();
if ($v2e3c048401582f4247d7ccac43657d2d) {
$vd3fbb9ff0b93cc92c5414344402a74bb = $this->relations->getOldTypeIdRelation($this->source_id, $v2e3c048401582f4247d7ccac43657d2d);
if ($vd3fbb9ff0b93cc92c5414344402a74bb === false) {
$vd3fbb9ff0b93cc92c5414344402a74bb = $v2e3c048401582f4247d7ccac43657d2d == self::$ROOT_PAGE_TYPE_ID ? '{root-pages-type}' : $v2e3c048401582f4247d7ccac43657d2d;
$this->relations->setTypeIdRelation($this->source_id, $vd3fbb9ff0b93cc92c5414344402a74bb, $v2e3c048401582f4247d7ccac43657d2d);
}
$v4a8a08f09d37b73795649038408b5f33->setAttribute('parent-id', $vd3fbb9ff0b93cc92c5414344402a74bb);
}
$v3643b86326b2ffcc0a085b4dd3a4309b = new DOMXPath($this->doc);
if ($v3643b86326b2ffcc0a085b4dd3a4309b->evaluate("base", $v4a8a08f09d37b73795649038408b5f33)->length) {
$v593616de15330c0fb2d55e55410bf994 = $v3643b86326b2ffcc0a085b4dd3a4309b->evaluate("base", $v4a8a08f09d37b73795649038408b5f33)->item(0);
$v593616de15330c0fb2d55e55410bf994->removeAttribute('id');
}
if ($v3643b86326b2ffcc0a085b4dd3a4309b->evaluate("fieldgroups/group", $v4a8a08f09d37b73795649038408b5f33)->length) {
foreach ($v3643b86326b2ffcc0a085b4dd3a4309b->evaluate("fieldgroups/group", $v4a8a08f09d37b73795649038408b5f33) as $vdb0f6f37ebeb6ea09489124345af2a45) {
$v47db2588331bbe530c80dd001fc60aed = $vdb0f6f37ebeb6ea09489124345af2a45->getAttribute('id');
$v7617417dc7eb3bbc463bf3c66d341d7b = $v599dcce2998a6b40b1e38e8c6006cb0a->getFieldsGroup($v47db2588331bbe530c80dd001fc60aed, true);
if ($v7617417dc7eb3bbc463bf3c66d341d7b->getIsActive()) {
$vdb0f6f37ebeb6ea09489124345af2a45->setAttribute('active', 'active');
} else {
$vdb0f6f37ebeb6ea09489124345af2a45->setAttribute('active', '0');
}
if (!$v7617417dc7eb3bbc463bf3c66d341d7b->getIsVisible()) {
$vdb0f6f37ebeb6ea09489124345af2a45->setAttribute('visible', '0');
}
$vdb0f6f37ebeb6ea09489124345af2a45->removeAttribute('id');
}
}
$v5df80bc8ce306a564d91fa6a4da3d95b = array();
$v8797e64b0b663bbad43134e3003a4ef4 = umiFieldsCollection::getInstance();
$v1a13105b7e4eb5fb2e7c9515ac06aa48 = $v3643b86326b2ffcc0a085b4dd3a4309b->evaluate("fieldgroups/group/field", $v4a8a08f09d37b73795649038408b5f33);
foreach ($v1a13105b7e4eb5fb2e7c9515ac06aa48 as $v06e3d36fa30cea095545139854ad1fb9) {
$v3aabf39f2d943fa886d86dcbbee4d910 = intval($v06e3d36fa30cea095545139854ad1fb9->getAttribute('id'));
$v73f329f154a663bfda020aadcdd0b775 = $v06e3d36fa30cea095545139854ad1fb9->getAttribute('name');
$v528ca8fdf35a8b13b093b5786a22c0bf = $this->relations->getOldFieldName($this->source_id, $v94757cae63fd3e398c0811a976dd6bbe, $v3aabf39f2d943fa886d86dcbbee4d910);
if ($v528ca8fdf35a8b13b093b5786a22c0bf === false) {
$this->relations->setFieldIdRelation($this->source_id, $v94757cae63fd3e398c0811a976dd6bbe, $v73f329f154a663bfda020aadcdd0b775, $v3aabf39f2d943fa886d86dcbbee4d910);
$v528ca8fdf35a8b13b093b5786a22c0bf = $v73f329f154a663bfda020aadcdd0b775;
} else {
$v06e3d36fa30cea095545139854ad1fb9->setAttribute('name', $v528ca8fdf35a8b13b093b5786a22c0bf);
}
if ($v06e3d36fa30cea095545139854ad1fb9->getElementsByTagName('restriction')->length) {
$v23604f9ddf406aa61ce8b1eaf9f6d39a = $v06e3d36fa30cea095545139854ad1fb9->getElementsByTagName('restriction')->item(0);
$v228c63e369a5906eb7f0500a13729edc = $v23604f9ddf406aa61ce8b1eaf9f6d39a->getAttribute('id');
$this->restrictions[] = $v228c63e369a5906eb7f0500a13729edc;
$this->restricted_fields[] = array('restriction-id' => $v228c63e369a5906eb7f0500a13729edc, 'field-name' => $v528ca8fdf35a8b13b093b5786a22c0bf, 'type-id' => $va240be392fd0549ece5558553983d79b);
$v23604f9ddf406aa61ce8b1eaf9f6d39a->removeAttribute('field-type-id');
}
$v051369818a8073bba5feeb0e957eb308 = $v06e3d36fa30cea095545139854ad1fb9->hasAttribute('guide-id') ? $v06e3d36fa30cea095545139854ad1fb9->getAttribute('guide-id') : false;
if ($v051369818a8073bba5feeb0e957eb308 && (!$this->ignoreRelations || in_array('guides', $this->saveRelations))) {
if ($this->exportType($v051369818a8073bba5feeb0e957eb308)) {
if ($this->limit && $this->position >= $this->limit) {
$this->break = true;
return true;
}
}
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('objects');
$v8be74552df93e31bbdd6b36ed74bdb6a->types('object-type')->id($v051369818a8073bba5feeb0e957eb308);
$v8be74552df93e31bbdd6b36ed74bdb6a->option('return')->value('id');
foreach ($v8be74552df93e31bbdd6b36ed74bdb6a->result as $v9b207167e5381c47682c6b4f58a623fb) {
if ($this->exportObject($v9b207167e5381c47682c6b4f58a623fb['id'])) {
if ($this->limit && $this->position >= $this->limit) {
$this->break = true;
return true;
}
}
//.........这里部分代码省略.........
示例3: importObjects
protected function importObjects(umiObjectType $v726e8e4809d4c1b28a6549d86436a124)
{
$v4340fd73e75df7a9d9e45902a59ba3a4 = $this->readNextRow();
$this->fields = count($v4340fd73e75df7a9d9e45902a59ba3a4);
$v5891da2d64975cae48d175d1e001f5da = umiObjectsCollection::getInstance();
$vd14a8022b085f9ef19d479cbdd581127 = umiObjectTypesCollection::getInstance();
$v9367a975f19a06750b67f719f4f08ceb = false;
if ($v726e8e4809d4c1b28a6549d86436a124->getId() == $vd14a8022b085f9ef19d479cbdd581127->getTypeIdByGUID('dispatches-subscriber')) {
$v9367a975f19a06750b67f719f4f08ceb = true;
}
$v7f2db423a49b305459147332fb01cf87 = outputBuffer::current();
def_module::$noRedirectOnPanic = true;
$v4340fd73e75df7a9d9e45902a59ba3a4 = $this->analyzeHeaders($v726e8e4809d4c1b28a6549d86436a124, $v4340fd73e75df7a9d9e45902a59ba3a4);
$v76cf1d4ff412fd3cb644aa58a53c78dc = array();
while ($v07d43db2a74336dcfbdaeeeffe6f7a19 = $this->readNextRow()) {
echo str_repeat(' ', 1024);
flush();
$v07d43db2a74336dcfbdaeeeffe6f7a19 = $this->analyzeColumns($v4340fd73e75df7a9d9e45902a59ba3a4, $v07d43db2a74336dcfbdaeeeffe6f7a19);
if (!isset($v07d43db2a74336dcfbdaeeeffe6f7a19['id'])) {
continue;
}
$v16b2b26000987faccb260b9d39df1269 = $v07d43db2a74336dcfbdaeeeffe6f7a19['id'];
if ($v9367a975f19a06750b67f719f4f08ceb && !$v16b2b26000987faccb260b9d39df1269) {
$v8be74552df93e31bbdd6b36ed74bdb6a = new selector('objects');
$v8be74552df93e31bbdd6b36ed74bdb6a->types('object-type')->name('dispatches', 'subscriber');
$v8be74552df93e31bbdd6b36ed74bdb6a->where('name')->equals($v07d43db2a74336dcfbdaeeeffe6f7a19['name']);
$v8be74552df93e31bbdd6b36ed74bdb6a->option('return')->value('id');
$result = $v8be74552df93e31bbdd6b36ed74bdb6a->first;
if (is_array($result) && count($result)) {
$v16b2b26000987faccb260b9d39df1269 = $result['id'];
}
}
if ($v16b2b26000987faccb260b9d39df1269) {
$vccae550f37edb4e56f3bf01df9953a6f = $v16b2b26000987faccb260b9d39df1269;
$v53cc4db543d7a569e51c1d76ac6f278e = 'systemModifyObject';
} else {
$v53cc4db543d7a569e51c1d76ac6f278e = 'systemCreateObject';
$v16b2b26000987faccb260b9d39df1269 = $v5891da2d64975cae48d175d1e001f5da->addObject('Temporary object name', $v726e8e4809d4c1b28a6549d86436a124->getId());
$v7f2db423a49b305459147332fb01cf87->push('//Create new object "' . $v07d43db2a74336dcfbdaeeeffe6f7a19['name'] . '" of type ' . $v726e8e4809d4c1b28a6549d86436a124->getId() . ', id #' . $v16b2b26000987faccb260b9d39df1269 . "\n");
$vccae550f37edb4e56f3bf01df9953a6f = 'new';
}
$va8cfde6331bd59eb2ac96f8911c4b666 = $v5891da2d64975cae48d175d1e001f5da->getObject($v16b2b26000987faccb260b9d39df1269);
if ($va8cfde6331bd59eb2ac96f8911c4b666 instanceof umiObject == false) {
$v76cf1d4ff412fd3cb644aa58a53c78dc[] = array('id' => $v16b2b26000987faccb260b9d39df1269, 'error' => getLabel('csv-error-not-found'), 'name' => $v07d43db2a74336dcfbdaeeeffe6f7a19['name']);
continue;
}
if ($va8cfde6331bd59eb2ac96f8911c4b666->getTypeId() != $v726e8e4809d4c1b28a6549d86436a124->getId()) {
$v76cf1d4ff412fd3cb644aa58a53c78dc[] = array('id' => $v16b2b26000987faccb260b9d39df1269, 'error' => getLabel('csv-error-wrong-type'), 'name' => $v07d43db2a74336dcfbdaeeeffe6f7a19['name']);
continue;
}
$vd05b6ed7d2345020440df396d6da7f73 = umiFieldsCollection::getInstance();
$_REQUEST['data'][$vccae550f37edb4e56f3bf01df9953a6f] = array();
foreach ($v4340fd73e75df7a9d9e45902a59ba3a4 as $v865c0c0b4ab0e063e5caa3387c1a8741 => $v46b9e6004c49d9cc040029c197cab278) {
if ($v865c0c0b4ab0e063e5caa3387c1a8741 == 'id') {
continue;
}
if ($v865c0c0b4ab0e063e5caa3387c1a8741 == 'name' && isset($v07d43db2a74336dcfbdaeeeffe6f7a19[$v865c0c0b4ab0e063e5caa3387c1a8741])) {
$_REQUEST['name'] = $v07d43db2a74336dcfbdaeeeffe6f7a19[$v865c0c0b4ab0e063e5caa3387c1a8741];
}
if (isset($v07d43db2a74336dcfbdaeeeffe6f7a19[$v865c0c0b4ab0e063e5caa3387c1a8741])) {
$_REQUEST['data'][$vccae550f37edb4e56f3bf01df9953a6f][$v865c0c0b4ab0e063e5caa3387c1a8741] = $v07d43db2a74336dcfbdaeeeffe6f7a19[$v865c0c0b4ab0e063e5caa3387c1a8741];
}
}
if ($v726e8e4809d4c1b28a6549d86436a124->getMethod() == 'user') {
$_REQUEST['data'][$vccae550f37edb4e56f3bf01df9953a6f]['password'][0] = 'dummyPassword';
}
try {
$v4119639092e62c55ea8be348e4d9260d = new umiEventPoint($v53cc4db543d7a569e51c1d76ac6f278e);
$v4119639092e62c55ea8be348e4d9260d->addRef("object", $va8cfde6331bd59eb2ac96f8911c4b666);
$v4119639092e62c55ea8be348e4d9260d->setMode("before");
$v4119639092e62c55ea8be348e4d9260d->call();
} catch (errorPanicException $ve1671797c52e15f763380b45e841ec32) {
$v76cf1d4ff412fd3cb644aa58a53c78dc[] = array('id' => $vccae550f37edb4e56f3bf01df9953a6f, 'error' => $ve1671797c52e15f763380b45e841ec32->getMessage(), 'name' => $v07d43db2a74336dcfbdaeeeffe6f7a19['name']);
if ($vccae550f37edb4e56f3bf01df9953a6f == 'new') {
$v5891da2d64975cae48d175d1e001f5da->delObject($v16b2b26000987faccb260b9d39df1269);
}
continue 1;
}
foreach ($v07d43db2a74336dcfbdaeeeffe6f7a19 as $v972bf3f05d14ffbdb817bef60638ff00 => $v2063c1608d6e0baf80249c42e2be5804) {
switch ($v972bf3f05d14ffbdb817bef60638ff00) {
case 'id':
continue;
case 'name':
$va8cfde6331bd59eb2ac96f8911c4b666->setName($v2063c1608d6e0baf80249c42e2be5804);
break;
default:
try {
$this->modifyProperty($va8cfde6331bd59eb2ac96f8911c4b666, $v972bf3f05d14ffbdb817bef60638ff00, $v2063c1608d6e0baf80249c42e2be5804);
} catch (fieldRestrictionException $ve1671797c52e15f763380b45e841ec32) {
$v76cf1d4ff412fd3cb644aa58a53c78dc[] = array('id' => $vccae550f37edb4e56f3bf01df9953a6f, 'error' => $ve1671797c52e15f763380b45e841ec32->getMessage(), 'name' => $v07d43db2a74336dcfbdaeeeffe6f7a19[$v972bf3f05d14ffbdb817bef60638ff00]);
}
break;
}
}
$va8cfde6331bd59eb2ac96f8911c4b666->commit();
try {
$v4119639092e62c55ea8be348e4d9260d->setMode('after');
$v4119639092e62c55ea8be348e4d9260d->call();
} catch (errorPanicException $ve1671797c52e15f763380b45e841ec32) {
$v76cf1d4ff412fd3cb644aa58a53c78dc[] = array('id' => $vccae550f37edb4e56f3bf01df9953a6f, 'error' => $ve1671797c52e15f763380b45e841ec32->getMessage(), 'name' => $v07d43db2a74336dcfbdaeeeffe6f7a19['name']);
//.........这里部分代码省略.........
示例4: 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')) {
//.........这里部分代码省略.........
示例5: guide_items_all
public function guide_items_all() {
$this->setDataType("list");
$this->setActionType("modify");
if($this->ifNotXmlMode()) return $this->doData();
$per_page = $this->per_page;
$guide_id = (int) getRequest('param0');
$sel = new selector('objects');
$sel->types('object-type')->id($guide_id);
$maxItemsCount = (int) mainConfiguration::getInstance()->get("kernel", "max-guided-items");
if ($maxItemsCount && $maxItemsCount <= 15 && $maxItemsCount > 0) {
$maxItemsCount = 16;
} elseif ($maxItemsCount <= 0) {
$maxItemsCount = 50;
}
if ($textSearch = getRequest('search')) {
foreach($textSearch as $searchString)
$sel->where('name')->like('%' . $searchString . '%');
}
if (!permissionsCollection::getInstance()->isSv()) {
$sel->where('guid')->notequals('users-users-15');
}
if(!is_null(getRequest('limit'))) {
$sel->limit((15 * (int) getRequest('p')), 15);
}
$sel->option('return')->value('count');
$total = $sel->length;
if(!is_null(getRequest('allow-empty')) && $total > $maxItemsCount) {
$data = Array(
'empty' => Array(
'attribute:total' => $total,
'attribute:result' => 'Too much items'
)
);
$this->setDataRange(0, 0);
$this->setData($data, $total);
return $this->doData();
} else {
$sel->flush();
$sel->option('return')->value('id');
$guide_items = array();
$tmp = array();
$objects = umiObjectsCollection::getInstance();
foreach($sel->result as $itemArray) {
$itemId = $itemArray['id'];
$item = $objects->getObject($itemId);
if ($item instanceof umiObject) {
$tmp[$itemId] = $item->getName();
$guide_items[$itemId] = $item;
}
}
if(!intval(regedit::getInstance()->getVal("//settings/ignore_guides_sort"))) {
natsort($tmp);
$guide_items = array_keys($tmp);
unset($tmp);
}
$this->setDataRangeByPerPage($maxItemsCount, 0);
$data = $this->prepareData($guide_items, "objects");
$this->setData($data, $total);
return $this->doData();
}
}
示例6: 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) {
//.........这里部分代码省略.........
示例7: 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;
}
示例8: renderEditFieldRelation
/**
* TODO PHPDoc
* Enter description here ...
* @param unknown_type $field
* @param unknown_type $is_multiple
* @param unknown_type $object
* @param unknown_type $template
*/
public function renderEditFieldRelation($field, $is_multiple, $object, $template)
{
if (!$field instanceof umiField) {
return;
}
$controller = cmsController::getInstance();
$objects = umiObjectsCollection::getInstance();
$guide_items = array();
$fieldName = $field->getName();
if ($guide_id = $field->getGuideId()) {
if ($controller->getCurrentMode() != "admin") {
$guide_items = $objects->getGuidedItems($guide_id);
} else {
try {
$sel = new selector('objects');
$sel->option('return')->value('count');
$sel->types('object-type')->id($guide_id);
$total = $sel->length;
} catch (selectorException $e) {
$total = 16;
}
if ($total <= 15) {
$sel->flush();
$sel->option('return')->value('id', 'name');
foreach ($sel->result as $item) {
$guide_items[$item['id']] = $item['name'];
}
} else {
if ($object instanceof iUmiObject) {
$val = $object->getValue($fieldName);
} else {
$val = false;
}
if ($val && !is_array($val)) {
$val = array($val);
}
if (is_array($val)) {
foreach ($val as $item_id) {
$item = $objects->getObject($item_id);
if ($item instanceof iUmiObject) {
$guide_items[$item_id] = $item->getName();
}
}
unset($item_id, $item, $val);
}
}
}
}
if (sizeof($guide_items) == 0) {
if ($object instanceof iUmiObject) {
$val = $object->getValue($fieldName);
if ($val && !is_array($val)) {
$val = array($val);
}
if (sizeof($val)) {
foreach ($val as $itemId) {
if ($item = selector::get('object')->id($itemId)) {
$guide_items[$itemId] = $item->name;
}
}
}
}
}
list($template_block, $template_block_line, $template_block_line_a, $template_mul_block, $template_mul_block_line, $template_mul_block_line_a) = def_module::loadTemplates("data/reflection/{$template}", "reflection_field_relation", "reflection_field_relation_option", "reflection_field_relation_option_a", "reflection_field_multiple_relation", "reflection_field_multiple_relation_option", "reflection_field_multiple_relation_option_a");
$block_arr = array();
$value = $object ? $object->getValue($fieldName) : array();
if ($fieldName == 'publish_status' && $controller->getCurrentMode() != "admin") {
return "";
}
$block_arr['attribute:name'] = $fieldName;
$block_arr['attribute:title'] = $field->getTitle();
$block_arr['attribute:tip'] = $field->getTip();
$block_arr['attribute:field_id'] = $field->getId();
if ($is_multiple) {
$block_arr['attribute:multiple'] = "multiple";
}
if ($guide_id) {
$block_arr['attribute:type-id'] = $guide_id;
$guide = umiObjectTypesCollection::getInstance()->getType($guide_id);
if ($guide instanceof umiObjectType) {
if ($guide->getIsPublic()) {
$block_arr['attribute:public-guide'] = true;
}
}
}
$options = $is_multiple ? array() : "";
foreach ($guide_items as $item_id => $item_name) {
$item_object = $objects->getObject($item_id);
if (!is_object($item_object)) {
continue;
}
if ($is_multiple) {
//.........这里部分代码省略.........
示例9: form
/** action="/webforms/send/" method='post' <input name='data[new][{{f.name}}]' ... */
function form($id)
{
$form = array();
$form['system_template'] = array('name' => 'system_template', 'type' => 'hidden', 'value' => $id);
$oTypes = \umiObjectTypesCollection::getInstance();
$aChilds = $oTypes->getChildClasses($oTypes->getBaseType("webforms", "form"));
$i = 0;
do {
$oForm = $oTypes->getType($aChilds[$i]);
$i++;
} while ($i < count($aChilds) && $oForm->getName() != $id);
$id = $oForm->getId();
$form['system_form_id'] = array('name' => 'system_form_id', 'type' => 'hidden', 'value' => $id);
$addresses = new \selector('objects');
$addresses->types('object-type')->name('webforms', 'address');
$addresses->option('no-length')->value(true);
$addresses->option('load-all-props')->value(true);
$addresses = $addresses->result();
foreach ($addresses as $address) {
if (get_class($address) != 'umiObject') {
continue;
}
if (in_array($id, explode(',', $address->getValue('form_id')))) {
$form['system_email_to'] = array('name' => 'system_email_to', 'type' => 'hidden', 'value' => $address->getId());
}
}
$type = \umiObjectTypesCollection::getInstance()->getType($id);
$groups = $type->getFieldsGroupsList();
foreach ($groups as $group) {
if (!$group->getIsActive() || !$group->getIsVisible() || $group->getName() == "locks") {
continue;
}
$fields = $group->getFields();
foreach ($fields as $field) {
if ($field->getIsVisible() || !$field->getIsSystem()) {
$f = array('name' => $field->getName(), 'title' => $field->getTitle(), 'tip' => $field->getTip(), 'required' => $field->getIsRequired(), 'type' => $field->getDataType());
if ($f['type'] == 'relation') {
$optionsId = $field->getGuideId();
$options = \umiObjectsCollection::getInstance()->getGuidedItems($optionsId);
$f['options'] = array();
foreach ($options as $oId => $oName) {
$f['options'][] = array('id' => $oId, 'name' => $oName);
}
}
$form[$field->getName()] = $f;
}
}
}
return $form;
}
示例10: generateFeed
public function generateFeed($elementId, $xslPath, $typeId = null)
{
$this->errorSetErrorPage('/');
if ($elementId && (!umiHierarchy::getInstance()->isExists($elementId) || !umiHierarchy::getInstance()->getElement($elementId)->getIsActive())) {
if (def_module::isXSLTResultMode()) {
$result = array('error' => '%data_feed_nofeed%');
return def_module::parseTemplate('', $result);
} else {
return '%data_feed_nofeed%';
}
}
if ($typeId) {
list($name, $ext) = explode('-', $typeId);
$hierarchyType = umiHierarchyTypesCollection::getInstance()->getTypeByName($name, $ext);
if ($hierarchyType) {
$typeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($hierarchyType->getId());
}
} elseif ($elementId) {
$typeId = umiHierarchy::getInstance()->getDominantTypeId($elementId);
} else {
$typeId = umiObjectTypesCollection::getInstance()->getTypeIdByGUID('news-item');
}
$type = umiObjectTypesCollection::getInstance()->getType($typeId);
if ($type instanceof umiObjectType) {
$module = $type->getModule();
$method = $type->getMethod();
}
if (!isset($module) && !isset($method)) {
if (def_module::isXSLTResultMode()) {
$result = array('error' => '%data_feed_nofeed%');
return def_module::parseTemplate('', $result);
} else {
return '%data_feed_nofeed%';
}
}
if (!$this->checkIfFeedable($module, $method)) {
if (def_module::isXSLTResultMode()) {
$result = array('error' => '%data_feed_wrong%');
return def_module::parseTemplate('', $result);
} else {
return '%data_feed_wrong%';
}
}
$rss_per_page = (int) regedit::getInstance()->getVal("//modules/news/rss_per_page");
$rss_per_page = $rss_per_page > 0 ? $rss_per_page : 10;
$sel = new selector('pages');
$sel->option('return')->value('id');
$sel->where('hierarchy')->page($elementId)->childs(100);
$sel->types('hierarchy-type')->name($module, $method);
if ($type->getFieldId('publish_time')) {
$sel->order('publish_time')->desc();
}
$sel->limit(0, $rss_per_page);
$result = array();
foreach ($sel->result() as $res) {
$result[] = $res['id'];
}
$exporter = new xmlExporter('rss');
$exporter->addElements($result);
$exporter->setIgnoreRelations();
$umiDump = $exporter->execute();
$styleFile = CURRENT_WORKING_DIR . "/" . $xslPath;
if (!is_file($styleFile)) {
throw new publicException("Can't load exporter {$styleFile}");
}
$doc = new DOMDocument("1.0", "utf-8");
$doc->formatOutput = XML_FORMAT_OUTPUT;
$doc->loadXML($umiDump->saveXML());
if (!$elementId) {
$elementId = umiHierarchy::getInstance()->getDefaultElementId();
}
$element = umiHierarchy::getInstance()->getElement($elementId);
$language = langsCollection::getInstance()->getLang($element->getLangId())->getPrefix();
$link = umiHierarchy::getInstance()->getPathById($elementId);
$description = $element->getIsDefault() ? '' : $element->getName();
$templater = umiTemplater::create('XSLT', $styleFile);
$templater->setAdditionalVariables(array('link' => $link, 'description' => $description, 'language' => $language));
$resultXml = $templater->parse($doc);
$buffer = outputBuffer::current();
$buffer->contentType('text/xml');
$buffer->clear();
$buffer->push($resultXml);
$buffer->end();
}
示例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) {
//.........这里部分代码省略.........