当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseModel::hasField方法代码示例

本文整理汇总了PHP中BaseModel::hasField方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::hasField方法的具体用法?PHP BaseModel::hasField怎么用?PHP BaseModel::hasField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseModel的用法示例。


在下文中一共展示了BaseModel::hasField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: caExtractEmbeddedMetadata


//.........这里部分代码省略.........
            if (($vs_raw_date = $va_exif_data['IFD0']['DateTimeOriginal']) || ($vs_raw_date = $va_exif_data['EXIF']['DateTimeOriginal'])) {
                $va_date_tmp = preg_split('![: ]+!', $vs_raw_date);
                $vs_date = $va_date_tmp[0] . '-' . $va_date_tmp[1] . '-' . $va_date_tmp[2] . 'T' . $va_date_tmp[3] . ':' . $va_date_tmp[4] . ':' . $va_date_tmp[5];
                foreach ($va_date_elements as $vs_element) {
                    $va_tmp = explode('.', $vs_element);
                    $po_instance->addAttribute(array($va_tmp[1] => $vs_date, 'locale_id' => $pn_locale_id), $va_tmp[1]);
                }
                $vb_did_mapping = true;
            }
        }
        if (is_array($va_date_containers)) {
            $t_list = new ca_lists();
            if (($vs_raw_date = $va_exif_data['IFD0']['DateTimeOriginal']) || ($vs_raw_date = $va_exif_data['EXIF']['DateTimeOriginal'])) {
                $va_date_tmp = preg_split('![: ]+!', $vs_raw_date);
                $vs_date = $va_date_tmp[0] . '-' . $va_date_tmp[1] . '-' . $va_date_tmp[2] . 'T' . $va_date_tmp[3] . ':' . $va_date_tmp[4] . ':' . $va_date_tmp[5];
                foreach ($va_date_containers as $vs_container => $va_info) {
                    $va_tmp = explode('.', $vs_container);
                    $vs_value_element = array_pop(explode('.', $va_info['value']));
                    $va_data = array($vs_value_element => $vs_date, 'locale_id' => $pn_locale_id);
                    if (isset($va_info['map']) && is_array($va_info['map'])) {
                        foreach ($va_info['map'] as $vs_sub_element => $vs_value) {
                            $va_tmp2 = explode('.', $vs_sub_element);
                            $vs_sub_element = array_pop($va_tmp2);
                            if ($t_element = $po_instance->_getElementInstance($vs_sub_element)) {
                                switch ($t_element->get('datatype')) {
                                    case 3:
                                        // List
                                        $va_data[$vs_sub_element] = $t_list->getItemIDFromList($t_element->get('list_id'), $vs_value);
                                        break;
                                    default:
                                        $va_data[$vs_sub_element] = $vs_value;
                                        break;
                                }
                            }
                        }
                    }
                    $po_instance->addAttribute($va_data, $va_tmp[1]);
                }
                $vb_did_mapping = true;
            }
        }
    }
    if (!isset($va_mappings[$po_instance->tableName()])) {
        return $vb_did_mapping;
    }
    $va_mapping = $va_mappings[$vs_tablename];
    $vs_type = $po_instance->getTypeCode();
    if (isset($va_mapping[$vs_type]) && is_array($va_mapping[$vs_type])) {
        $va_mapping = $va_mapping[$vs_type];
    } else {
        if (isset($va_mapping['__default__']) && is_array($va_mapping['__default__'])) {
            $va_mapping = $va_mapping['__default__'];
        } else {
            return $vb_did_mapping;
        }
    }
    foreach ($va_mapping as $vs_metadata => $va_attr) {
        $va_tmp = explode(":", $vs_metadata);
        foreach ($va_attr as $vs_attr) {
            $va_metadata =& $pa_metadata;
            foreach ($va_tmp as $vs_el) {
                if (isset($va_metadata[$vs_el])) {
                    $va_metadata =& $va_metadata[$vs_el];
                } else {
                    continue 2;
                }
            }
            if (is_array($va_metadata)) {
                $va_metadata = join(";", $va_metadata);
            }
            if (!is_int($va_metadata)) {
                // pass ints through for values like WhiteBalance = 0
                if (!trim($va_metadata)) {
                    continue 2;
                }
            }
            $va_tmp2 = explode(".", $vs_attr);
            switch ($va_tmp2[0]) {
                case 'preferred_labels':
                    $po_instance->replaceLabel(array($va_tmp2[1] => $va_metadata), $pn_locale_id, null, true);
                    break;
                case 'nonpreferred_labels':
                    $po_instance->replaceLabel(array($va_tmp2[1] => $va_metadata), $pn_locale_id, null, false);
                    break;
                default:
                    if ($po_instance->hasField($vs_attr)) {
                        $po_instance->set($vs_attr, $va_metadata);
                    } else {
                        // try as attribute
                        if (sizeof($va_tmp2) == 2) {
                            // format ca_objects.foo, we only want "foo"
                            $po_instance->replaceAttribute(array($va_tmp2[1] => $va_metadata, 'locale_id' => $pn_locale_id), $va_tmp2[1]);
                        }
                    }
            }
            $vb_did_mapping = true;
        }
    }
    return $vb_did_mapping;
}
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:mediaPluginHelpers.php

示例2: getTypeID

 /**
  * 
  */
 public function getTypeID()
 {
     return BaseModel::hasField('type_id') ? BaseModel::get('type_id') : null;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:7,代码来源:BaseRelationshipModel.php

示例3: _checkAccess

 /**
  * Called just after record is deleted. Individual editor controllers can override this to implement their
  * own post-deletion cleanup logic.
  *
  * @param BaseModel $pt_subject Model instance of row that was deleted
  * @return bool True if post-deletion cleanup was successful, false if not
  */
 protected function _checkAccess($pt_subject, $pa_options = null)
 {
     //
     // Is record deleted?
     //
     if ($pt_subject->hasField('deleted') && $pt_subject->get('deleted')) {
         if (!caGetOption('dontRedirectOnDelete', $pa_options, false)) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2550?r=' . urlencode($this->request->getFullUrlPath()));
         }
         return false;
     }
     //
     // Is record of correct type?
     //
     $va_restrict_to_types = null;
     if ($pt_subject->getAppConfig()->get('perform_type_access_checking')) {
         $va_restrict_to_types = caGetTypeRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__));
     }
     if (is_array($va_restrict_to_types) && ($pt_subject->get('type_id') && ($pt_subject->getPrimaryKey() && !in_array($pt_subject->get('type_id'), $va_restrict_to_types)))) {
         $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2560?r=' . urlencode($this->request->getFullUrlPath()));
         return false;
     }
     //
     // Is record from correct source?
     //
     $va_restrict_to_sources = null;
     if ($pt_subject->getAppConfig()->get('perform_source_access_checking') && $pt_subject->hasField('source_id')) {
         if (is_array($va_restrict_to_sources = caGetSourceRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__)))) {
             if (!$pt_subject->get('source_id') || $pt_subject->get('source_id') && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources) || strlen($vn_source_id = $this->request->getParameter('source_id', pInteger)) && !in_array($vn_source_id, $va_restrict_to_sources)) {
                 $pt_subject->set('source_id', $pt_subject->getDefaultSourceID(array('request' => $this->request)));
             }
             if (is_array($va_restrict_to_sources) && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources)) {
                 $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2562?r=' . urlencode($this->request->getFullUrlPath()));
                 return;
             }
         }
     }
     //
     // Does user have access to row?
     //
     if ($pt_subject->getAppConfig()->get('perform_item_level_access_checking') && $vn_subject_id) {
         if ($pt_subject->checkACLAccessForUser($this->request->user) < __CA_BUNDLE_ACCESS_READONLY__) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
             return false;
         }
     }
     return true;
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:55,代码来源:BaseEditorController.php

示例4: getTypeID

 /**
  * 
  */
 public function getTypeID($pn_id = NULL)
 {
     if ($pn_id) {
         $qr_res = $this->getDb()->query("SELECT type_id FROM " . $this->tableName() . " WHERE " . $this->primaryKey() . " = ?", array((int) $pn_id));
         if ($qr_res->nextRow()) {
             return $qr_res->get('type_id');
         }
         return null;
     }
     return BaseModel::hasField('type_id') ? BaseModel::get('type_id') : null;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:14,代码来源:BaseRelationshipModel.php


注:本文中的BaseModel::hasField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。