function countTrueEvents($arConditions)
 {
     //echo "<pre>";print_r($arConditions);echo "</pre>";
     foreach ($arConditions as $child) {
         if (strlen($child["CLASS_ID"]) > 0 && !empty($child["DATA"])) {
             switch ($child["CLASS_ID"]) {
                 case 'CondUserName':
                     if (CFoodclubEventCompare::compareString($this->_fields["NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondUserLastName':
                     if (CFoodclubEventCompare::compareString($this->_fields["LAST_NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondUserEmail':
                     if (CFoodclubEventCompare::compareString($this->_fields["EMAIL"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondPersonalPhoto':
                     $user = self::getUserFields();
                     if (CFoodclubEventCompare::compare($user["PERSONAL_PHOTO"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondUserWorkWWW':
                     if (CFoodclubEventCompare::compareString($this->_fields["WORK_WWW"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBTags":
                     if (CFoodclubEventCompare::compare($this->_fields["TAGS"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBModifiedBy":
                     if (CFoodclubEventCompare::compare($this->_fields["MODIFIED_BY"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondUserDateRegister":
                     $user = self::getUserFields();
                     if ($user["DATE_REGISTER"]) {
                         if (CFoodclubEventCompare::compareDates($user["DATE_REGISTER"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                             self::increas();
                         }
                     }
                     break;
                 case "CondUserLADate":
                     $user = self::getUserFields();
                     if ($user["LAST_ACTIVITY_DATE"]) {
                         if (CFoodclubEventCompare::compareDates($user["LAST_ACTIVITY_DATE"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                             self::increas();
                         }
                     }
                     break;
                 case "CondIBTimestampX":
                     $date = isset($this->_fields["TIMESTAMP_X"]) ? $this->_fields["TIMESTAMP_X"] : $this->_fields["~TIMESTAMP_X"];
                     if (CFoodclubEventCompare::compareDates($date, $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBCreatedBy":
                     if (CFoodclubEventCompare::compare($this->_fields["CREATED_BY"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBDateCreate":
                     $date = isset($this->_fields["DATE_CREATE"]) ? $this->_fields["DATE_CREATE"] : $this->_fields["~DATE_CREATE"];
                     if (CFoodclubEventCompare::compareDates($date, $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBDetailText":
                     if (CFoodclubEventCompare::compare($this->_fields["DETAIL_TEXT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBPreviewText":
                     if (CFoodclubEventCompare::compare($this->_fields["PREVIEW_TEXT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBSort":
                     if (CFoodclubEventCompare::compare($this->_fields["SORT"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBDateActiveTo":
                     if (CFoodclubEventCompare::compareDates($this->_fields["ACTIVE_TO"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBDateActiveFrom":
                     if (CFoodclubEventCompare::compareDates($this->_fields["ACTIVE_FROM"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBActive":
                     if (CFoodclubEventCompare::compare($this->_fields["ACTIVE"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBName":
                     if (CFoodclubEventCompare::compare($this->_fields["NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBXmlID":
                     if (CFoodclubEventCompare::compare($this->_fields["XML_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBCode":
                     if (CFoodclubEventCompare::compare($this->_fields["CODE"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondGroup":
                     //Проверяем группу условий
                     if (CFoodclubEventUtils::recursive_array_search("CondQuantityValue", $child["CHILDREN"]) !== false) {
                         //check child event elements with property value
                         if (self::checkQuantityCond($child)) {
                             self::increas();
                         }
                     } else {
                         //check child event elements
                         if (self::checkChildCond($child)) {
                             self::increas();
                         }
                     }
                     break;
                 case "CondUserGroup":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compareArrayValue(CUser::GetUserGroupArray(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBElement":
                     if (CFoodclubEventCompare::compare($this->_fields["ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBSection":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compare($this->_fields["SECTION_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBIBlock":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compare($this->_fields["IBLOCK_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondUser":
                     //Проверяем пользователя
                     if (CFoodclubEventCompare::compare(CUser::GetID(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
             }
         }
     }
 }
Exemplo n.º 2
0
 function countTrueEvents($arConditions)
 {
     foreach ($arConditions as $child) {
         if (strlen($child["CLASS_ID"]) > 0 && !empty($child["DATA"])) {
             switch ($child["CLASS_ID"]) {
                 case 'CondUserName':
                     if (CFoodclubEventCompare::compareString($arFields["NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondUserLastName':
                     if (CFoodclubEventCompare::compareString($arFields["LAST_NAME"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondUserEmail':
                     if (CFoodclubEventCompare::compareString($arFields["EMAIL"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case 'CondPersonalPhoto':
                     /*if(CFoodclubEventCompare::compare(
                           $arFields["EMAIL"],
                           $child["DATA"]["logic"],
                           $child["DATA"]["value"]
                       ))
                       {
                           self::increas();
                       }*/
                     break;
                 case 'CondUserWorkWWW':
                     if (CFoodclubEventCompare::compareString($arFields["WORK_WWW"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondUserGroup":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compareArray(CUser::GetUserGroupArray(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBElement":
                     if (CFoodclubEventCompare::compare($arFields["ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBSection":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compare($arFields["SECTION_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondIBIBlock":
                     //Проверяем группу пользователя
                     if (CFoodclubEventCompare::compare($arFields["IBLOCK_ID"], $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
                 case "CondUser":
                     //Проверяем пользователя
                     if (CFoodclubEventCompare::compare(CUser::GetID(), $child["DATA"]["logic"], $child["DATA"]["value"])) {
                         self::increas();
                     }
                     break;
             }
         }
     }
 }