Ejemplo n.º 1
0
 protected static function CreateLogicalField($fieldName, &$arFields)
 {
     global $DB;
     $fieldName = strval($fieldName);
     if ($fieldName === 'TYPE_NAME') {
         if (isset(self::$FIELDS_CACHE[LANGUAGE_ID]) && isset(self::$FIELDS_CACHE[LANGUAGE_ID]['TYPE_NAME'])) {
             $arFields['TYPE_NAME'] = self::$FIELDS_CACHE[LANGUAGE_ID]['TYPE_NAME'];
             return;
         }
         $arTypeDescr = CCrmActivityType::GetAllDescriptions();
         if (count($arTypeDescr) == 0) {
             return;
         }
         $sql = 'CASE ' . self::TABLE_ALIAS . '.TYPE_ID';
         foreach ($arTypeDescr as $typeID => &$typeDescr) {
             $sql .= " WHEN {$typeID} THEN '{$DB->ForSql($typeDescr)}'";
         }
         unset($typeDescr);
         $sql .= ' END';
         if (!isset(self::$FIELDS_CACHE[LANGUAGE_ID])) {
             self::$FIELDS_CACHE[LANGUAGE_ID] = array();
         }
         $arFields['TYPE_NAME'] = self::$FIELDS_CACHE[LANGUAGE_ID]['TYPE_NAME'] = array('FIELD' => $sql, 'TYPE' => 'string');
     }
 }
Ejemplo n.º 2
0
 public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
 {
     $descriptions = null;
     $name = strtoupper($name);
     if ($name === 'OWNERTYPE') {
         $descriptions = CCrmOwnerType::GetDescriptions(array(CCrmOwnerType::Lead, CCrmOwnerType::Deal, CCrmOwnerType::Contact, CCrmOwnerType::Company));
     } elseif ($name === 'CONTENTTYPE') {
         $descriptions = CCrmContentType::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYTYPE') {
         $descriptions = CCrmActivityType::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYPRIORITY') {
         $descriptions = CCrmActivityPriority::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYDIRECTION') {
         $descriptions = CCrmActivityDirection::GetAllDescriptions();
     } elseif ($name === 'ACTIVITYNOTIFYTYPE') {
         $descriptions = CCrmActivityNotifyType::GetAllDescriptions();
     }
     if (!is_array($descriptions)) {
         return parent::processMethodRequest($name, $nameDetails, $arParams, $nav, $server);
     }
     $result = array();
     foreach ($descriptions as $k => &$v) {
         $result[] = array('ID' => $k, 'NAME' => $v);
     }
     unset($v);
     return $result;
 }