public function translateData(iUmiField $v06e3d36fa30cea095545139854ad1fb9) { $v26b75b176d665f24a5fd22a2ad815763 = array('attribute:id' => $v06e3d36fa30cea095545139854ad1fb9->getId(), 'attribute:name' => $v06e3d36fa30cea095545139854ad1fb9->getName(), 'attribute:title' => $v06e3d36fa30cea095545139854ad1fb9->getTitle(), 'attribute:field-type-id' => $v06e3d36fa30cea095545139854ad1fb9->getFieldTypeId()); if ($v06e3d36fa30cea095545139854ad1fb9->getIsVisible()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:visible'] = "visible"; } if ($v06e3d36fa30cea095545139854ad1fb9->getIsInheritable()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:inheritable'] = "inheritable"; } if ($v06e3d36fa30cea095545139854ad1fb9->getIsLocked()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:locked'] = "locked"; } if ($v06e3d36fa30cea095545139854ad1fb9->getIsInFilter()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:filterable'] = "filterable"; } if ($v06e3d36fa30cea095545139854ad1fb9->getIsInSearch()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:indexable'] = "indexable"; } if ($v051369818a8073bba5feeb0e957eb308 = $v06e3d36fa30cea095545139854ad1fb9->getGuideId()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:guide-id'] = $v051369818a8073bba5feeb0e957eb308; } if ($v6a2139364f96787c8ce1bbb0070b898c = $v06e3d36fa30cea095545139854ad1fb9->getTip()) { $v26b75b176d665f24a5fd22a2ad815763['tip'] = $v6a2139364f96787c8ce1bbb0070b898c; } if ($v06e3d36fa30cea095545139854ad1fb9->getIsRequired()) { $v26b75b176d665f24a5fd22a2ad815763['attribute:required'] = "required"; } if ($v6b1a57fa235477758817df3c91158006 = $v06e3d36fa30cea095545139854ad1fb9->getRestrictionId()) { $v26b75b176d665f24a5fd22a2ad815763['restriction'] = baseRestriction::get($v6b1a57fa235477758817df3c91158006); } $v26b75b176d665f24a5fd22a2ad815763['type'] = $v06e3d36fa30cea095545139854ad1fb9->getFieldType(); return $v26b75b176d665f24a5fd22a2ad815763; }
public function validateValue($v2063c1608d6e0baf80249c42e2be5804) { if ((is_null($v2063c1608d6e0baf80249c42e2be5804) || $v2063c1608d6e0baf80249c42e2be5804 === false || $v2063c1608d6e0baf80249c42e2be5804 === "") && $this->field->getIsRequired()) { throw new valueRequiredException(getLabel('error-value-required', null, $this->getTitle())); } if ($v2063c1608d6e0baf80249c42e2be5804 && ($v6b1a57fa235477758817df3c91158006 = $this->field->getRestrictionId())) { $v3dadfaeb46ec74762b37de11fea7605c = baseRestriction::get($v6b1a57fa235477758817df3c91158006); if ($v3dadfaeb46ec74762b37de11fea7605c instanceof baseRestriction) { if ($v3dadfaeb46ec74762b37de11fea7605c instanceof iNormalizeInRestriction) { $v2063c1608d6e0baf80249c42e2be5804 = $v3dadfaeb46ec74762b37de11fea7605c->normalizeIn($v2063c1608d6e0baf80249c42e2be5804, $this->object_id); } if ($v3dadfaeb46ec74762b37de11fea7605c->validate($v2063c1608d6e0baf80249c42e2be5804, $this->object_id) === false) { throw new wrongValueException(getLabel($v3dadfaeb46ec74762b37de11fea7605c->getErrorMessage(), null, $this->getTitle())); } } } return $v2063c1608d6e0baf80249c42e2be5804; }
public function __call($vea9f6aca279138c58f705c8d4cb4b8ce, $args) { $vea9f6aca279138c58f705c8d4cb4b8ce = strtolower($vea9f6aca279138c58f705c8d4cb4b8ce); if (in_array($vea9f6aca279138c58f705c8d4cb4b8ce, $this->modes)) { $v2063c1608d6e0baf80249c42e2be5804 = sizeof($args) ? $args[0] : null; if ($v2063c1608d6e0baf80249c42e2be5804 instanceof iUmiEntinty) { $v2063c1608d6e0baf80249c42e2be5804 = $v2063c1608d6e0baf80249c42e2be5804->getId(); } if (isset($this->fieldId)) { $v06e3d36fa30cea095545139854ad1fb9 = selector::get('field')->id($this->fieldId); if ($v6b1a57fa235477758817df3c91158006 = $v06e3d36fa30cea095545139854ad1fb9->getRestrictionId()) { $v3dadfaeb46ec74762b37de11fea7605c = baseRestriction::get($v6b1a57fa235477758817df3c91158006); if ($v3dadfaeb46ec74762b37de11fea7605c instanceof iNormalizeInRestriction) { $v2063c1608d6e0baf80249c42e2be5804 = $v3dadfaeb46ec74762b37de11fea7605c->normalizeIn($v2063c1608d6e0baf80249c42e2be5804); } } if (is_numeric($v2063c1608d6e0baf80249c42e2be5804) && substr($v2063c1608d6e0baf80249c42e2be5804, 0, 1) !== "0") { $v2063c1608d6e0baf80249c42e2be5804 = (double) $v2063c1608d6e0baf80249c42e2be5804; } if ($v06e3d36fa30cea095545139854ad1fb9->getDataType() == 'relation' && is_string($v2063c1608d6e0baf80249c42e2be5804)) { if ($v52eb29c6d8ea0d3a5bb3654f49bbd7c7 = $v06e3d36fa30cea095545139854ad1fb9->getGuideId()) { $v8be74552df93e31bbdd6b36ed74bdb6a = new selector('objects'); $v8be74552df93e31bbdd6b36ed74bdb6a->types('object-type')->id($v52eb29c6d8ea0d3a5bb3654f49bbd7c7); $v8be74552df93e31bbdd6b36ed74bdb6a->where('*')->ilike($v2063c1608d6e0baf80249c42e2be5804); $v2fa47f7c65fec19cc163b195725e3844 = sizeof($v8be74552df93e31bbdd6b36ed74bdb6a->result); if ($v2fa47f7c65fec19cc163b195725e3844 > 0 && $v2fa47f7c65fec19cc163b195725e3844 < 100) { $v2063c1608d6e0baf80249c42e2be5804 = $v8be74552df93e31bbdd6b36ed74bdb6a->result; } } } if ($v06e3d36fa30cea095545139854ad1fb9->getDataType() == 'date' && is_string($v2063c1608d6e0baf80249c42e2be5804)) { $v5fc732311905cb27e82d67f4f6511f7f = new umiDate(); $v5fc732311905cb27e82d67f4f6511f7f->setDateByString(trim($v2063c1608d6e0baf80249c42e2be5804, ' %')); $v2063c1608d6e0baf80249c42e2be5804 = $v5fc732311905cb27e82d67f4f6511f7f->getDateTimeStamp(); } } $this->value = $v2063c1608d6e0baf80249c42e2be5804; $this->mode = $vea9f6aca279138c58f705c8d4cb4b8ce; } else { throw new selectorException("This property doesn't support \"{$vea9f6aca279138c58f705c8d4cb4b8ce}\" method"); } }
protected function exportRestriction($v228c63e369a5906eb7f0500a13729edc) { if (isset($this->exported_restrictions[$v228c63e369a5906eb7f0500a13729edc])) { return false; } $v3dadfaeb46ec74762b37de11fea7605c = baseRestriction::get($v228c63e369a5906eb7f0500a13729edc); if (!$v3dadfaeb46ec74762b37de11fea7605c instanceof baseRestriction) { return false; } $vf3ecaaa779127f3ec136cca581bfaf46 = $v3dadfaeb46ec74762b37de11fea7605c->getClassName(); $vf52176cf6508ff07e507a49978c0fc2f = $v3dadfaeb46ec74762b37de11fea7605c->getTitle(); $v94757cae63fd3e398c0811a976dd6bbe = $v3dadfaeb46ec74762b37de11fea7605c->getFieldTypeId(); $v599dcce2998a6b40b1e38e8c6006cb0a = umiFieldTypesCollection::getInstance()->getFieldType($v94757cae63fd3e398c0811a976dd6bbe); $v17f71d965fe9589ddbd11caf7182243e = $v599dcce2998a6b40b1e38e8c6006cb0a->getDataType(); $v96a76ec43956dac431b643cbd544dd08 = $v599dcce2998a6b40b1e38e8c6006cb0a->getIsMultiple(); $v6896b87ef0ed896869194f78f21380e7 = $this->relations->getOldRestrictionIdRelation($this->source_id, $v228c63e369a5906eb7f0500a13729edc); if (!$v6896b87ef0ed896869194f78f21380e7) { $this->relations->setRestrictionIdRelation($this->source_id, $v228c63e369a5906eb7f0500a13729edc, $v228c63e369a5906eb7f0500a13729edc); $v6896b87ef0ed896869194f78f21380e7 = $v228c63e369a5906eb7f0500a13729edc; } $vd95679752134a2d9eb61dbd7b91c4bcc = $this->doc->createElement('restriction'); $vd95679752134a2d9eb61dbd7b91c4bcc->setAttribute('id', $v6896b87ef0ed896869194f78f21380e7); $vd95679752134a2d9eb61dbd7b91c4bcc->setAttribute('prefix', $vf3ecaaa779127f3ec136cca581bfaf46); $vd95679752134a2d9eb61dbd7b91c4bcc->setAttribute('title', $vf52176cf6508ff07e507a49978c0fc2f); $vd95679752134a2d9eb61dbd7b91c4bcc->setAttribute('field-type', $v17f71d965fe9589ddbd11caf7182243e); $vd95679752134a2d9eb61dbd7b91c4bcc->setAttribute('is-multiple', $v96a76ec43956dac431b643cbd544dd08); foreach ($this->restricted_fields as $v3c6e0b8a9c15224a8228b9a98ca1531d => $v2063c1608d6e0baf80249c42e2be5804) { if ($v2063c1608d6e0baf80249c42e2be5804['restriction-id'] == $v228c63e369a5906eb7f0500a13729edc) { $v8fa14cdd754f91cc6554c9e71929cce7 = $this->doc->createElement('field'); $v8fa14cdd754f91cc6554c9e71929cce7->setAttribute('field-name', $v2063c1608d6e0baf80249c42e2be5804['field-name']); $v8fa14cdd754f91cc6554c9e71929cce7->setAttribute('type-id', $v2063c1608d6e0baf80249c42e2be5804['type-id']); $vd95679752134a2d9eb61dbd7b91c4bcc->appendChild($v8fa14cdd754f91cc6554c9e71929cce7); } } $this->restrictions_container->appendChild($vd95679752134a2d9eb61dbd7b91c4bcc); $this->exported_restrictions[$v228c63e369a5906eb7f0500a13729edc] = $v6896b87ef0ed896869194f78f21380e7; $this->position++; return true; }
public function checkRequiredFieldsCustom($typeId) { $type = umiObjectTypesCollection::getInstance()->getType($typeId); if (!$type instanceof umiObjectType) { throw new coreException(getLabel('label-cannot-detect-type')); } $allFields = $type->getAllFields(); $inputData = getRequest('data'); if ((!$inputData || !@is_array($inputData['new'])) && !isset($_FILES['data']['name']['new'])) { $inputData = array(); } else { $tmp = array(); if (@is_array($inputData['new'])) { $tmp = array_merge($tmp, $inputData['new']); } if (isset($_FILES['data']['name']['new']) && is_array($_FILES['data']['name']['new'])) { $tmp = array_merge($tmp, $_FILES['data']['name']['new']); } $inputData = $tmp; } $errorFields = array(); foreach ($allFields as $field) { if ($field->getIsRequired()) { $fieldName = $field->getName(); $bool = false; if ($restrictionId = $field->getRestrictionId()) { $restriction = baseRestriction::get($restrictionId); if ($restriction instanceof baseRestriction) { $value = $inputData[$fieldName]; if ($restriction instanceof iNormalizeInRestriction) { $value = $restriction->normalizeIn($value); } $bool = !$restriction->validate($value); } } if (!isset($inputData[$fieldName]) || empty($inputData[$fieldName]) || $bool) { $errorFields[] = $field->getId(); } } } return !empty($errorFields) ? $errorFields : true; }
protected function translateData(baseRestriction $v3dadfaeb46ec74762b37de11fea7605c) { return array('attribute:id' => $v3dadfaeb46ec74762b37de11fea7605c->getId(), 'attribute:name' => $v3dadfaeb46ec74762b37de11fea7605c->getClassName(), 'attribute:field-type-id' => $v3dadfaeb46ec74762b37de11fea7605c->getFieldTypeId(), 'node:title' => $v3dadfaeb46ec74762b37de11fea7605c->getTitle()); }
protected function importRestriction(DOMElement $vcaf9b6b99962bf5c2264824231d7a40c) { $v61ce6a78cb3c8547fed20990c92edfe3 = $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('id'); $vd5d3db1765287eef77d7927cc956f50a = $vcaf9b6b99962bf5c2264824231d7a40c->hasAttribute('title') ? $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('title') : null; $v851f5ac9941d720844d143ed9cfcf60a = $vcaf9b6b99962bf5c2264824231d7a40c->hasAttribute('prefix') ? $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('prefix') : null; $v17f71d965fe9589ddbd11caf7182243e = $vcaf9b6b99962bf5c2264824231d7a40c->hasAttribute('field-type') ? $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('field-type') : null; $vce495ab8d79db0d37413d8e95b54e606 = $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('is-multiple') == 1 || $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('is-multiple') == "multiple"; if (!strlen($v61ce6a78cb3c8547fed20990c92edfe3)) { $this->reportError($this->getLabel('label-cannot-create-restriction') . " \"{$vd5d3db1765287eef77d7927cc956f50a}\" " . $this->getLabel('label-with-empty-id')); return false; } $vdb6d9b451b818ccc9a449383f2f0c450 = umiFieldTypesCollection::getInstance(); $v519504d7d4beb745dac24ccfb6c1d7c9 = $vdb6d9b451b818ccc9a449383f2f0c450->getFieldTypeByDataType($v17f71d965fe9589ddbd11caf7182243e, $vce495ab8d79db0d37413d8e95b54e606); $v94757cae63fd3e398c0811a976dd6bbe = $v519504d7d4beb745dac24ccfb6c1d7c9->getId(); $ve2fa538867c3830a859a5b17ab24644b = false; $v228c63e369a5906eb7f0500a13729edc = false; if (!$vd5d3db1765287eef77d7927cc956f50a) { $vd5d3db1765287eef77d7927cc956f50a = $v61ce6a78cb3c8547fed20990c92edfe3; } if (baseRestriction::find($v851f5ac9941d720844d143ed9cfcf60a, $v94757cae63fd3e398c0811a976dd6bbe)) { $v228c63e369a5906eb7f0500a13729edc = baseRestriction::find($v851f5ac9941d720844d143ed9cfcf60a, $v94757cae63fd3e398c0811a976dd6bbe)->getId(); if ($v228c63e369a5906eb7f0500a13729edc != $this->relations->getNewRestrictionIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3)) { $this->relations->setRestrictionIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3, $v228c63e369a5906eb7f0500a13729edc); } } if (!$v228c63e369a5906eb7f0500a13729edc) { $v228c63e369a5906eb7f0500a13729edc = $this->relations->getNewRestrictionIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3); } if (!$v228c63e369a5906eb7f0500a13729edc) { $v228c63e369a5906eb7f0500a13729edc = baseRestriction::add($v851f5ac9941d720844d143ed9cfcf60a, $vd5d3db1765287eef77d7927cc956f50a, $v94757cae63fd3e398c0811a976dd6bbe); $this->relations->setRestrictionIdRelation($this->source_id, $v61ce6a78cb3c8547fed20990c92edfe3, $v228c63e369a5906eb7f0500a13729edc); $ve2fa538867c3830a859a5b17ab24644b = true; } $v3dadfaeb46ec74762b37de11fea7605c = baseRestriction::get($v228c63e369a5906eb7f0500a13729edc); if (!$v3dadfaeb46ec74762b37de11fea7605c instanceof baseRestriction) { $this->reportError($this->getLabel('label-cannot-detect-restriction') . " \"{$vd5d3db1765287eef77d7927cc956f50a}\""); return false; } if ($ve2fa538867c3830a859a5b17ab24644b) { $this->created_restrictions++; $this->writeLog($this->getLabel('label-restriction') . " \"" . $v3dadfaeb46ec74762b37de11fea7605c->getTitle() . "\" (" . $v61ce6a78cb3c8547fed20990c92edfe3 . ") " . $this->getLabel('label-has-been-created-n')); } $vd05b6ed7d2345020440df396d6da7f73 = $vcaf9b6b99962bf5c2264824231d7a40c->getElementsByTagName('field'); foreach ($vd05b6ed7d2345020440df396d6da7f73 as $v39b7b22d803b1a0270c9c6c6f8a3b4cb) { $v6adb6b0ad1941d569b23e089910c5e74 = $v39b7b22d803b1a0270c9c6c6f8a3b4cb->getAttribute('field-name'); $v2741adf691b2acf0359a6a73234bc605 = $v39b7b22d803b1a0270c9c6c6f8a3b4cb->getAttribute('type-id'); $v87306dd4235ed712ebc07fe169b76f83 = $this->relations->getNewTypeIdRelation($this->source_id, $v2741adf691b2acf0359a6a73234bc605); if (!$v87306dd4235ed712ebc07fe169b76f83) { continue; } $v3aabf39f2d943fa886d86dcbbee4d910 = umiObjectTypesCollection::getInstance()->getType($v87306dd4235ed712ebc07fe169b76f83)->getFieldId(self::translateName($v6adb6b0ad1941d569b23e089910c5e74), false); if (!$v3aabf39f2d943fa886d86dcbbee4d910) { umiObjectTypesCollection::getInstance()->getType($v87306dd4235ed712ebc07fe169b76f83)->getFieldId($v6adb6b0ad1941d569b23e089910c5e74, false); } $v06e3d36fa30cea095545139854ad1fb9 = umiFieldsCollection::getInstance()->getField($v3aabf39f2d943fa886d86dcbbee4d910); if (!$v06e3d36fa30cea095545139854ad1fb9 instanceof umiField) { $this->reportError($this->getLabel('label-cannot-set-restriction-for-field') . " \"{$v6adb6b0ad1941d569b23e089910c5e74}\": " . $this->getLabel('label-cannot-detect-field')); continue; } $v06e3d36fa30cea095545139854ad1fb9->setRestrictionId($v228c63e369a5906eb7f0500a13729edc); $v06e3d36fa30cea095545139854ad1fb9->setIsUpdated(); $this->writeLog($this->getLabel('label-restriction') . " \"" . $v3dadfaeb46ec74762b37de11fea7605c->getTitle() . "\" " . $this->getLabel('label-has-been-set-for-field') . " \"{$v6adb6b0ad1941d569b23e089910c5e74}\""); } return $v3dadfaeb46ec74762b37de11fea7605c; }
public function getRestrictionsList() { $this->templatesMode('xslt'); $block_arr = array(); $restrictions = baseRestriction::getList(); $items_arr = array(); foreach ($restrictions as $restriction) { if ($restriction instanceof baseRestriction) { $items_arr[] = $restriction; } } $block_arr['items']['nodes:item'] = $items_arr; return $block_arr; }
/** * Проверить, все ли обязательные для заполения поля имеют значения * @param umiObjectType $type тип данных редактируемого объекта * @param Array $data массив передаваемых значений * @param Integer $objectId id текущего объекта * @param Boolean $isNew true, если мы создаем новый объект или страницу * @param Array массив значений, при необходимости скорректированный */ public function checkRequiredData(iUmiObjectType $objectType, $data, $objectId, $isNew) { if (!is_array($data)) { return $data; } $cmsController = cmsController::getInstance(); $admin = $cmsController->getCurrentMode() == "admin"; $wrongFieldsCount = 0; $fields = umiFieldsCollection::getInstance(); foreach ($data as $fieldName => &$value) { $fieldId = $objectType->getFieldId($fieldName); $field = $fields->getField($fieldId); if ($field instanceof umiField == false) { continue; } if ($field->getIsRequired()) { if (is_null($value) || $value === false || $value === "") { $fieldTitle = $field->getTitle(); $errstr = $admin ? "%errors_missed_field_value%" : getLabel('error-missed-field-value'); $this->errorNewMessage($errstr . " \"{$fieldTitle}\"", false, 100, "input-missed-field"); ++$wrongFieldsCount; } } if ($restrictionId = $field->getRestrictionId()) { $restriction = baseRestriction::get($restrictionId); if ($restriction instanceof baseRestriction) { if ($restriction instanceof iNormalizeInRestriction) { $value = $restriction->normalizeIn($value); } if ($restriction->validate($value) == false) { $fieldTitle = $field->getTitle(); $errstr = $admin ? "%errors_wrong_field_value%" : getLabel('error-wrong-field-value'); $errstr .= " \"{$fieldTitle}\" - " . $restriction->getErrorMessage(); $this->errorNewMessage($errstr, false, 101, "input-wrong-field"); ++$wrongFieldsCount; } } } } if ($wrongFieldsCount > 0) { if ($isNew && $objectId) { //Delete object and page if exists (thes don't fit for us) $hierarchy = umiHierarchy::getInstance(); $elementIds = $hierarchy->getObjectInstances($objectId); if (sizeof($elementIds)) { //Delete created page. For ever. foreach ($elementIds as $elementId) { $hierarchy->delElement($elementId); $hierarchy->removeDeletedElement($elementId); } } umiObjectsCollection::getInstance()->delObject($objectId); } $this->errorPanic(); } return $data; }